I've been asked to name three things that can not be inherited from the base class.
Apart from private member functions, what else can I add?
I thought about friend functions but since they don't actually belong to the class, they have nothing to do with inheritance.
A few obvious ones you usually care about are constructors, assignment operators and destructors.
In all these cases, a new version specific to the derived class is either provided by the user, or else synthesized by the compiler (though C++11 also adds some capabilities for things like simply deleting one that you don't want available).
I should probably add that "can not be inherited" isn't necessarily exactly correct. For example, C++11 adds inheriting constructors (but they weren't in C++98/03, which is what most courses still deal with). Even in C++11, you don't inherit them by default.
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