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
explain the term 'resource acquisition is initialization'?
What is object-oriented programming? Webopedia definition
What is pointer to member?
Why is c++ a mid-level programming language?
What is ifstream c++?
What is abstraction c++?
Is it possible to provide special behavior for one instance of a template but not for other instances?
What parameter does the constructor to an ofstream object take?
What is static in c++?
Name the debugging methods that are used to solve problems?
What is abstraction with real time example?
What are the benefits of oop?
What is stl stand for?
What is helper in c++?
what is a pragma in C++?