I have a parent class "base" and another class "derived" that inherits from "base".
"derived" has 1 method cH1.
if I do this:
base* b = new derived();
And I want to be able to do this:
b->cH1();
Obviously I can't and there are 2 solutions:
- Either declare cH1 as pure virtual in base.
or do this:
dynamic_cast<derived*>(b)->cH1();
Which one is a better practice?