Which problem does a virtual base class address?
-
A
Duplicate base subobjects in diamond inheritance
Correct answer
-
B
Virtual calls made on const objects
-
C
Leaks caused by missing virtual destructors
-
D
Ambiguity between overloaded operators
Correct answer
A. Duplicate base subobjects in diamond inheritance
12 views
Explanation
A virtual base is shared by every path of the hierarchy, so a diamond keeps exactly one copy of it.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ