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 / ragib nasir ahmed

A virtual base class is one in which only one copy of the
base class is inherited to the derived class.
Let us consider the classes A,B,C,D
class A
{
int a;
public:
void geta(void)
{
a=10;
}
};
class B: public virtual A
{
int b;
public:
void getb(void)
{
b=20;
}
};
class C:virtual public A
{
int c;
public:
void getc(void)
{
c=30;
}
};
class D:public B,public C
{
public:
void display(void)
{
cout<<a<<b<<c<<d;
}
};

Is This Answer Correct ?    25 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a set in c++?

977


What is the difference between set and map in c++?

1136


What is stl in c++ with example?

1161


Explain the difference between using macro and inline functions?

1125


What is stl containers in c++?

1050


write a program that will accept a number and print.its equivalent in words the maximum input number is 9999

3028


How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?

2314


Define the operators that can be used with a pointer.

1053


What is c++ redistributable?

1231


Describe Trees using C++ with an example.

1154


What is an inclusion guard?

1200


What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random

1131


What is the advantage of oop over procedural language?

1088


Is python written in c or c++?

1148


How can you overcome the diamond problem in inheritance?

1184