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


Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

program for insertion ,deletion,sorting in double link list

2276


How many human genes are polymorphic?

568


What is and I oop mean?

616


Why is it so that we can have virtual constructors but we cannot have virtual destructors?

3823


What is polymorphism in oop example?

513






What is encapsulation and abstraction? How are they implemented in C++?

632


which feature are not hold visual basic of oop?

1721


What is the point of polymorphism?

583


What is polymorphism explain its types?

674


Is html an oop?

576


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1652


What are different oops concepts?

570


Can you inherit a private class?

631


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

2752


what's the basic's in dot net

1734