MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Fundamental Programming
Object-Oriented Concepts
Beginner
Q
The 'diamond problem' in C++ multiple inheritance is solved by which feature?
AVirtual functions
BVirtual inheritance
CAbstract classes
DFriend classes
Correct Answer:
B. Virtual inheritance
Explanation:
With class B : virtual public A, only one shared A subobject exists in the most-derived class.
ALSO KNOW (related points):
• Which description best defines encapsulation? → Bundling data with the methods that operate on it and restricting direct access to the internal state