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 polymorpsim? what are its types?

8 Answers  


How would you stop a class from class from being derived or inherited.

18 Answers   Ness Technologies,


What are the different forms of polymorphism??

8 Answers   Mantaq, NUC, PCS,


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

1 Answers   TCS,


What is abstraction and encapsulation?

1 Answers  


What is class and object with example?

1 Answers  


write a program to find 2 power of a 5digit number with out using big int and exponent ?

1 Answers  


I am developing a payroll system mini project.I used file concept in program for reading and writing.When the program is reloading into the memory that is if i execute next time the file was cleaned and adding data from the starting this is my problem.I want to strore the previous data and if i want to add any record that should be next of previous data.Please help me.

0 Answers  


any one please tell me the purpose of operator overloading

1 Answers   Amazon,


What is new keyword in oops?

1 Answers  


What is virtual constructors/destructors?

4 Answers   IBS,


WRITE A SIMPLE C++ PROGRAM TO SWAP TWO NOS WITHOUT USING TEMP

2 Answers  


Categories