Use virtual functions. On object of type Child
, fnc2
defined in Parent
will call fnc1
of derived class Child
:
class Parent {
public:
virtual void fnc1() {
}
void fnc2 {
...
fnc1();
...
}
}
class Child : public Parent {
public:
virtual void fnc1() {
...
}
}