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

Explain the isa and hasa class relationships.

1038


Can I uninstall microsoft c++ redistributable?

1114


What does std :: flush do?

1134


Write about the stack unwinding?

1059


What do manipulators do?

1013


What is the full form of ios?

1068


Why is "using namespace std;" considered bad practice?

1098


What does ctime() do?

1127


What is property in oops?

1061


describe private access specifiers?

1235


Explain what are mutator methods in c++?

1119


What is istream and ostream in c++?

1129


When one must use recursion function? Mention what happens when recursion functions are declared inline?

1190


What is abstraction oop?

1091


C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.

844