TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Multiple Inheritance in C++
Barkha Gupta
Jan 24
2016
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
* /program to illustrate multiple inheritance./ *
#include < iostream > using namespace std;
class
M
{
protected
:
int
m;
public
:
void
get(
int
);
};
class
N
{
protected
:
int
n;
public
:
void
getdata(
int
);
};
class
P:
public
M,
public
N
{
public
:
void
display(
void
);
};
void
M::get(
int
x)
{
m = x;
}
void
N::getdata(
int
y)
{
n = y;
}
void
P::display(
void
)
{
cout <<
"\nm="
<< m;
cout <<
"\nn="
<< n;
cout <<
"\nm * n:"
<< m * n;
}
int
main()
{
P obj;
obj.get(10);
obj.getdata(20);
obj.display();
return
0;
}
Inheritence
C++
OOPS