ambiguity regulation of multiple inheritance with example.
Answer / 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 |
What is ambiguity in c++
In c++ there is only virtual destructors, no constructors. Why?
i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<<k; } //please comment on the output
In which cases you use override and new base?
can you give real time example for polymarphism
hi all..i want to know oops concepts clearly can any1 explain??
Why do we use encapsulation in oops?
What is property in oops?
what is the usage of clas templates
why the argument is passed by reference to a copy constructor?example?
Write a program to demonstrate the use of 'Composition' in C++
who is the founder of c++?