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 a virtual base class?

Answer Posted / atul jawale

Virtual base class is a base class acts as an indirect base
for more than one without duplication of its data members.

A single copy of its data members is shared by all the base
classes that use it as a virtual base.

For example:
A
/ \
B C
\ /
D

class A { /* ... */ }; // indirect base class
class B : virtual public A { /* ... */ };
class C : virtual public A { /* ... */ };
class D : public B, public C { /* ... */ }; // valid

Using the keyword virtual in this example ensures that an
object of class D inherits only one subobject of class A.

Is This Answer Correct ?    75 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does int * mean in c++?

1237


What are issues if we mix new and free in C++?

794


Do you know about latest advancements in C++ ?

1254


Will c++ be replaced?

1053


What is dev c++ used for?

1050


Can recursive program be written in C++?

1242


Differentiate between late binding and early binding. What are the advantages of early binding?

1041


How can you quickly find the number of elements stored in a dynamic array?

1058


What is a singleton c++?

1013


How does polymorphism work?

1150


Can java be faster than c++?

1165


Is arr and &arr are same expression for an array?

1063


What will the line of code below print out and why?

746


What is an abstract class in C++

1042


What is a literal in c++?

1112