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
What does I ++ mean in c++?
Are c and c++ different?
What is long in c++?
What is oops concept with example?
What kind of problems can be solved by a namespace?
In what situations do you have to use initialization list rather than assignment in constructors?
What is encapsulation in ict?
Why do we learn c++?
Explain the static storage classes in c++.
What is a type library?
How to get the current position of the file pointer?
Is rust better than c++?
What is oops with example?
How do you establish an is-a relationship?
Is map ordered c++?