I have a abstract base class . There are many abstract classes which derived from this Abstract Base class
#if ABI_VERSION_ATLEAST1
class Base
{
public:
virtual void food() =0
};
#endif
for example
#if ABI_VERSION_ATLEAST1
class Derived1: public Base
{
};
#endif
Suppose i want to add new method to it, without breaking binary compatibility. The only way is to extend this class
#if ABI_VERSION_ATLEAST2
class Base_Ext : public Base
{
public:
virtual void food1()=0;
};
#endif
The problem is the already existing derived classes implementation wont be able to access this food1(). How to solve this problem How can Abstract Derived classes see this new method
One solution i have in mind is : -
i would need to extend Derived1.......
#if ABI_VERSION_ATLEAST2
class Derived2 : public Derived1, public Base_Ex
{
} ;
#endif
again here to solve diamond problem, I will have to change
class Derived1: public Base to
class Derived1: public virtual Base {}
which i dont want to do.. as it would again break binary compatibility of existing derived classes.so stuck at it