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
Write a C++ Program to check whether a number is prime number or not?
If dog is a friend of boy, is boy a friend of dog?
What is a pointer with example?
What is data hiding c++?
Can you please explain the difference between overloading and overriding?
Differentiate between late binding and early binding. What are the advantages of early binding?
Write a program to find the Fibonacci series recursively.
What is the use of endl in c++ give an example?
Explain rethrowing exceptions with an example?
What is the use of dot in c++?
What is this weird colon-member (" : ") syntax in the constructor?
What is c++ programming language?
Where is atoi defined?
What is c++ runtime?
What is the array and initializing arrays in c++?