Can I write a class which has virtual methods - (which can be overridden but have a default behaviour) and also abstract methods - (which have to be overridden)
Can I have a definition in which I define implementations for the virtuals but not the abstracts?
Additionally can I create abstract methods that don't have an implementation in a non abstract / pure virtual class?
Can I write a class which has virtual methods - (which can be overridden but have a default behaviour) and also abstract methods - (which have to be overridden)
Yes.
Can I have a definition in which I define implementations for the virtuals but not the abstracts?
Yes.
Additionally can I create abstract methods that don't have an implementation in a non abstract / pure virtual class?
No. The presence of pure virtual members prohibits you from creating class instances, i.e. makes the class abstract.
It' s ok to have some virtual methods with reasonable default implementation, while other pure virtual methods have to be implemented in derived classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With