WAP to find the ambiguities in Multiple Inheritance? How
are they
resolved.(Virtual Functions)




WAP to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtua..

Answer / niraj verma

Multiple Inheritance:-

A class can inherit the attributes of two or more classes.
This is know as multiple inheritance. Multiple inheritance
allows us to combine the features of several existing
classes as a starting point for designing new classes. It is
like a child inheriting the physical features of one parent
and the intelligence of onother.

In Multiple
Inheritance the derived class inherit the properly of more
than one base class.



Example:-
# include<iosteam.h>
# include<conio.h>
Class A
{
Protected:
Int x;
Public:
Void getdata ( )
{
Cout<<”\n Enter any
number”;
Cin>>x;
}
};
Class B
Protected:
Int y;
Public:
Void getadta2 ( )
{
Cout<<”\n Enter any number”;
Cin>>y;
}
};
Class c: public A, public B
{
Private:
M, z;
Public:
Void getdata3 ( )
{
Cout<<”\n Enter
any number”;
Cin>>m;
}
Void calculate ( )
{
Z = x*y+m;
}
Void display (
)
{
Cout <<
“\n Result =”<<z;
}
};
Void main ( )
{
C obj;
Obj. getdata1 ( );
Obj. getdata2 ( );
Obj. getdata3 ( );
Obj. calculate ( );
Obj. display ( );
Getch ( );
}

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More OOPS Interview Questions

What is Virtual Keyword?

9 Answers   IBM, NA,


What is an interface in oop?

0 Answers  


What is a superclass in oop?

0 Answers  


what is difference b/w object based and object oriented programming language?

18 Answers   Chaitanya, College School Exams Tests, Educomp, IBM, Infosys, Telko,


Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.

0 Answers  






What is difference between pop and oop?

0 Answers  


what is the difference between a package and a software?

3 Answers  


why overriding?

3 Answers  


what is the usage of clas templates

5 Answers  


How Do you Code Composition and Aggregation in C++ ?

3 Answers   IBM, NET,


what is overloading

3 Answers   MindCracker,


Write 7 differences between "Public" function and "Private" function?

2 Answers   IBM, Wipro,


Categories