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 graphics

0 Answers  


c++ is a purely oop concept?

3 Answers   Google, TCS,


function overridind means and simple program

2 Answers  


What is differance between Abstract and Interface

3 Answers  


In which Scenario you will go for Interface or Abstract Class?

1 Answers   InfoAxon Technologies,






what is the use of template classes in c++

1 Answers  


What is polymorphism? Explain with an example.

48 Answers  


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

0 Answers   HCL,


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

2 Answers   IBM, Wipro,


Why do we use inheritance?

0 Answers  


What does and I oop and sksksk mean?

0 Answers  


how do u initialize the constant variables

5 Answers   IBM, Siemens,


Categories