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 are the main differences between procedure oriented languages and object oriented languages?
9 Answers IBM, Infosys, Wipro,
Why is polymorphism important in oop?
What is difference between function overloading and overriding?
how to find no of instances of an object in .NET?
can you give the dynamic polymorphism types?
write knight tour problem which is present in datastructure
What is a mixin class?
create a c++ program that will ask 10 numbers and display their sum using array.
What is debug class?what is trace class? What differences are between them? With examples.
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 this interview room ? Is it a class or an object.
write a program that takes input in digits and display the result in words from 1 to 1000