What is multiple inheritance? Give Example
Answers were Sorted based on User's Feedback
Answer / hemanth
When class is derived from more than one base class, it is
called as multiple inheritance.
Class a {
int b;
public:
void fun();
}
Class C {
int d;
public:
void fun();
}
Class d :public a, public c {
int x;
void fun1();
}
----------
Here class d inherits class a and c, hence multiple inheritance.
Is This Answer Correct ? | 33 Yes | 0 No |
Answer / shree
class one
{
int a;
Public void Add();
}
Class Two
{ int b;
Public void Sub();
}
class Three:class one , class two
{
int c;
Public void Mul();
}
In this last class we inherited first two class that is more than one base class so mulptiple inheritance.
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / arun
A class is derived from more than one base class, it is
called as multiple inheritance.
Class a {
int b;
public:
void fun();
}
Class C {
int d;
public:
void fun();
}
Class d :public a, public c {
int x;
void fun1();
}
----------
Here class d inherits class a and c, hence multiple inheritance.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sadikhasan,meta
Multiple inheritance means duplicate copy of base class is
derive into child class. which explain by following example.
class A
{
}
class B: public A
{
}
class C:public A
{
}
class D:public B,public C //duplicate data
{
}
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / palsaniya sadikhasan, meta.
Sorry! Following example is the Multilevel inheritance.
which Post by me.
a class is derived from an existing class in multiple level.
e.g.
class abc
{
int a;
public:
void getdata();
};
class xyz public:abc
{
int b;
public:
void getinput();
}
class pqr public:xyz
{
int c;
public:
void show();
}
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / palsaniya sadikhasan, meta.
a class is derived from an existing class in multiple level.
e.g.
class abc
{
int a;
public:
void getdata();
};
class xyz public:abc
{
int b;
public:
void getinput();
}
class pqr public:xyz
{
int c;
public:
void show();
}
Is This Answer Correct ? | 9 Yes | 22 No |
What are the benefits of oop?
explain dynamic binding by drowing
any one please tell me the purpose of operator overloading
How is data security provided in Object Oriented languages? ?
When will a constructor executed?
what's the basic's in dot net
inheritence with example
What is balance factor?
i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<<k; } //please comment on the output
Why static functions always uses static variables?
what is oops
What is a friend function & its advantage?