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 class?

Answer Posted / kar4you

Suppose you have two derived classes B and C that have a
common base class A, and you also have another class D that
inherits from B and C. You can declare the base class A as
virtual to ensure that B and C share the same subobject of
A.

In the following example, an object of class D has two
distinct subobjects of class L, one through class B1 and
another through class B2. You can use the keyword virtual
in front of the base class specifiers in the base lists of
classes B1 and B2 to indicate that only one subobject of
type L, shared by class B1 and class B2, exists.

class L { /* ... */ }; // indirect base class
class B1 : virtual public L { /* ... */ };
class B2 : virtual public L { /* ... */ };
class D : public B1, public B2 { /* ... */ }; // valid

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between encapsulation and polymorphism?

1113


what are the realtime excercises in C++?

2846


What is methods in oop?

982


i got a backdoor offer in process global,Bangalore..Can i work with it?

2845


What is encapsulation selenium?

1016


Is react oop?

1073


What is byval and byref? What are differences between them?

2220


Is this job good for future? can do this job post grduate student?

2166


What is polymorphism in oop example?

1031


What is oops?what is its use in software engineering?

1035


How is polymorphism achieved?

1057


write a program that takes input in digits and display the result in words from 1 to 1000

2432


Why do we need polymorphism in c#?

1174


What is the difference between procedural programming and oops?

1137


How to use CMutex, CSemaphore in VC++ MFC

4786