adspace
Write A Program to find the ambiguities in Multiple
Inheritance? How are they
resolved.(Virtual Functions)
Answer Posted / Ranjit Kumar
In C++, when a class derives from more than one base class that have conflicting member functions, it is known as multiple inheritance ambiguity. This ambiguity can be resolved using virtual functions. A pure virtual function (declared with = 0) in the base class must be overridden by derived classes. When an object of the derived class is accessed polymorphically (through a base class pointer or reference), the correct version of the overridden function is called due to the presence of virtual keyword.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers