ambiguity regulation of multiple inheritance with example.
Answer Posted / sahadev tarei
if A class have one function fun().B is a another class
derived from A and it has also one function fun().C is
another function derived from B and also It has one
function Fun().for the role of inheritance C contains 3 fun
().
1. Fun()---inherited from A
2. fun()--- inherited from B
3. fun() -- own C class function
When a user create an object of C and invock to A class Fun
().It wont. tais ambiguti
Example:-
class A
{
public:
void fun()
{
cout<<"A"
}
}
class B:public A
{
public:
void fun()
{
cout<<"B"
}
}
class C:public B
{
public:
void fun()
{
cout<<"C"
}
}
int main()
{
C obj;
obj.fun()---- acess C class function
obj.A::fun();---invock A class function
obj.B::fun();---invocks B class function
return 0;
}
output
C A B
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is encapsulation with real life example?
What do you mean by abstraction?
how to get the oracle certification? send me the answer
How Do you Code Composition and Aggregation in C++ ?
What does and I oop and sksksk mean?
What are the important components of cohesion?
Is abstract thinking intelligence?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
What is oops and why we use oops?
What do you mean by variable?
What is abstraction in oops?
Explain the advantages of inheritance.
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
What is oops with example?
What is overriding in oop?