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 difference b/w object based and object oriented programming language?
18 Answers Chaitanya, College School Exams Tests, Educomp, IBM, Infosys, Telko,
What is a scope operator and tell me its functionality?
to remove the repeated numbers from the given . i.e.., if the input is 12233 output should of 123
explain sub-type and sub class? atleast u have differ it into 4 points?
what is the diffrence between c# and c++
Program to check whether a word starts with a capital letter or not.
How would you stop a class from class from being derived or inherited.
How to improve object oriented design skills?
What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
What do you mean by Encapsulation?
what is the 3 types of system development life cycle
Why a "operator=(...)" when there is a copy ctor?