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
They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?
Is c++ a high level language?
How do you traverse a btree in backward in-order?
Explain some examples of operator overloading?
class type to basic type conversion
When should we use multiple inheritance?
What is object in c++ example?
What does std :: flush do?
What is overloading unary operator?
What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)
What is a sequence in c++?
Explain the FOR loop with a help of a code.
Can turbo c++ run c program?
Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.
What is the difference between delegation and implemented-in-terms-of?