ambiguity regulation of multiple inheritance with example.



ambiguity regulation of multiple inheritance with example...

Answer / sahadev tarei

if A class have one function fun().B is a another class
derived from A and it has also one function fun().C is
another function derived from B and also It has one
function Fun().for the role of inheritance C contains 3 fun
().
1. Fun()---inherited from A
2. fun()--- inherited from B
3. fun() -- own C class function

When a user create an object of C and invock to A class Fun
().It wont. tais ambiguti
Example:-

class A
{
public:
void fun()
{
cout<<"A"
}
}
class B:public A
{
public:
void fun()
{
cout<<"B"
}
}

class C:public B
{
public:
void fun()
{
cout<<"C"
}
}

int main()
{

C obj;
obj.fun()---- acess C class function
obj.A::fun();---invock A class function
obj.B::fun();---invocks B class function
return 0;
}

output
C A B

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More OOPS Interview Questions

Can we have a private virtual method ?

8 Answers   Ness Technologies,


How to use CMutex, CSemaphore in VC++ MFC

0 Answers   Persistent, TCS,


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

0 Answers  


what is oops

4 Answers   DELL,


Generally, in all C++ programs, texts are in white colour. Can we change the colour of the text(either input or output or both)? If so, help me out.

1 Answers  






what is the use of classes in c++;

2 Answers   HCL,


What is polymorphism? Explain with an example.

48 Answers  


What is the difference between a mixin and inheritance?

0 Answers  


define oops with class and object

5 Answers   HCL, Tech Mahindra,


What is interface in oop?

0 Answers  


what are three tenets of object orinted Systems?Why they call like that ? Please answer me. Advance thanks.

2 Answers   Excel,


What is R T T I ?

6 Answers   Ness Technologies,


Categories