Abstract base class question

Totally dumb question, I know, but....

What determines whether or not a method must be overridden when deriving from an abstract base class?

class ABC
{
virtual void PrintFunc() = 0;
};

Now if I derive a class from ABC why must PrintFunc() be redefined for the new derived class?

What if the ABC class had something else I wanted but I did not need this particular method in the derived class?

Would I still need to include a definition for PrintFunc() in the derived class?
Last edited on
A virtual = 0 function is basically like an interface, saying "classes that inherit from this will have this method, but I don't have enough information to give you anything but the definition"

Yes, you would, otherwise the new class is also abstract (and thus cannot be instantiated).
Thank you! This is exactly what I needed. I am trying to learn the ins and outs of an event system setup, but could not remember why certain function in an ABC must be re-defined in derived classes.
Topic archived. No new replies allowed.