Advanced Inheritence Flashcards

1
Q

What is multiple inheritence in C++?

A

The ability to inherit from multiple classes simultaneously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the best practice for DTORs as it relates to multiple inheritence?

A

Have DTORs be virtual.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you work around naming conflicts in multiple inheritence?

A

Specifing the namespace of the ambigious item.
Ex: namespace::item

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the “Dreaded Diamond”?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the solution to the “Dreaded Diamond”?

A

Virtual Inheritence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the cost of virtual inheritence?

A

Extra work for the compiler.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly