Advanced Inheritence Flashcards
What is multiple inheritence in C++?
The ability to inherit from multiple classes simultaneously.
What is the best practice for DTORs as it relates to multiple inheritence?
Have DTORs be virtual.
How do you work around naming conflicts in multiple inheritence?
Specifing the namespace of the ambigious item.
Ex: namespace::item
What is the “Dreaded Diamond”?
A multiple inheritence scenario where a Base class has two derived classes, and a fourth class inherits from both derived classes. Now there two seperate instances of the base class data members in the fourth class.
What is the solution to the “Dreaded Diamond”?
Virtual Inheritence
What is the cost of virtual inheritence?
Extra work for the compiler.