ambiguity regulation of multiple inheritance with example.
Answer Posted / 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 View All Answers
Can a varargs method be overloaded?
What is destructor oops?
what's the basic's in dot net
Where You Can Use Interface in your Project
Can enum be null?
any one please tell me the purpose of operator overloading
What are the benefits of polymorphism?
What is overriding vs overloading?
What is encapsulation process?
What is a null tree?
What is polymorphism used for?
Which type does string inherit from?
What is polymorphism in oops with example?
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
what is the sylabus for priliminaries?