Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is Virtual Inheritance?

Answer Posted / rama

The duplication of inherited members due to multiple paths can be avoided by making the common base class(ancestor class) as virtual base class..

FOR EXAMPLE

class A //grandparent
{
...
...
};
class B1:virtual public A //parent1
{
...
...
};
class B2:public virtual A //parent2
{
...
...
};
class C :public B1,public B2
{
... //only one copy of A
... //will be inherited
};


When a class is made a virtual base class, it take necessary care to see that only one copy of that class is inherited, regardless of how many inheritance paths exits between the virtual base class and a derived class.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many characters are recognized by ANSI C++?

1465


which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?

1235


What is object in c++ wikipedia?

1061


What is rvalue?

1188


What is a sequence in c++?

1072


Is there structure in c++?

1078


What is an orthogonal base class in c++?

1210


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

2625


Is it legal in c++ to overload operator++ so that it decrements a value in your class?

1114


What does flush do?

1047


what are the events occur in intr activated on interrupt vector table

1798


Do you know what is overriding?

1292


What is the full form of india?

1198


Why do we need runtime polymorphism in c++?

1071


Explain bubble sorting.

1142