I have a base class with pure virtual functions and I have a derived class with definitions for the base class virtual functions as well as its own functions.
Now I have pointed the base class object to derive class, like:
Base *bc =new Child();
I want to call the child class method (not defined or declared in the parent) using this object.
But I am getting compiler error memeberFunction not define in Base class
.
The code is as:
class Base
{
public:
virtual void method1() = 0;
};
class child : public Base
{
public:
virtual void method1() {}
void Method2() { /* some implementation */ }
};
How can I achieve this?
bc->Method2();