Write A Program to find the ambiguities in Multiple
Inheritance? How are they
resolved.(Virtual Functions)
Answer / 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 |
why c++ is a highlevel language
3 Answers Satyam, Tech Mahindra,
//what is wrong with the programme?? #include<iostream.h> template <class first> class dd { first i; public: void set(); void print(); }; void dd< first>:: set() { cin>>i; } void dd< first>::print() { cout<<"\n"<<i; } void main() { dd <char>g; g.set(); g.print(); }
Name an advantage of array over linked list?
24 Answers GML, IBM, Software Solutions,
what is Class in oops with example?
what are the ways in which a constructors can be called?
What is Inheritance, Multiple Inheritance, Shared and Repeatable Inheritance?
State what is encapsulation and friend function?
What is the example of polymorphism?
Which language is pure oop?
Difference ways of Polymorphism?
What is inheritance in simple words?
how to write a java program for an output ****0 ***01 **012 *0123 01234