Inheritance is the second requirement for membership in the object-oriented club - but full membership only requires single inheritance. Programming languages supporting multiple inheritance allow a subclass or child to have more than one superclass or parent. Multiple inheritance is neither required by the object-oriented paradigm nor universally supported by object-oriented programming languages. C++'s support for multiple inheritance has always been controversial.
class Person { }; class List { }; class PersonList : public Person, public List { }; |
||
(a) | (b) | (c) |
void PersonList::function() { public: f(); // (a) g(); h("Dilbert"); // (b) h(100); } void PersonList::display() { public: Person::display(); // (c) List::display(); } |
(a) | (b) |