Pergunta

Does the ABI of the view of a class remain stable even if other changes, involving virtuals, are made in the derived class?

That is, say I have an interface InterfaceA (abstract class with many pure virtual functions) and a class DerivedB that inherits from it. I write a library that has a function taking a InterfaceA *. What I want to know is whether the interface remains binary compatible so long as the interface itself does not change.

Clear, if I modify InterfaceA I do not expect the code to be binary compatible. However, what if I just modify DerivedB, say I inherit more interfaces or add other virtual functions. In the most extreme say I multiply inherit from another class which defines InterfaceA. Does InterfaceA remain binary compatible despite all these changes?

My assumption, and experience, to now is that yes it is compatible. I'm just looking for confirmation of this (or refutation if not compatible).

Note: I don't care about dynamic typing, or other casting, I only care about the interface functions themselves.

Also Note: Assume the compiler versions being used are ABI stable as whole -- no major version changes.

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top