Add new method to Abstract Base Class C++ [duplicate]

  abstract, c++, facade, inheritance

I have a abstract base class . There are many abstract classes which derived from this Abstract Base class

class Base
{
public:
  virtual void food() =0
};

for example

class Derived: public Base
{
};

Suppose i want to add new method to it, without breaking binary compatibility.
The only way is to extend this class

class Base_Ext : public Base
{
public:
  virtual void food1()=0;
};

The problem is the already existing derived classes implemntation wont be able to access this food1().
How to solve this problem

Source: Windows Questions C++

LEAVE A COMMENT