What is virtual base class?

Showing Answers 1 - 15 of 15 Answers

harithasri

  • Feb 12th, 2007
 

Actually virtual meaning is which doesnot exist in the real world. Here virtual base class means which has virtual member function but defined in derived class.

  Was this answer useful?  Yes

chinmay nayak

  • Feb 13th, 2007
 

virtual classes are generally used in hybrid inheritance for exp:Their are two classes B & C derived from publically from A and in turn a class D has been derived from class B & C so to avoid the inheritance of multiple copies of certain function in A into D through B & C virtual classes are used.

  Was this answer useful?  Yes

narsi

  • Mar 1st, 2007
 

It is very much useful in hybrid inheritence.

By declaring the class we can get only one copy of it when it was inherited.

  Was this answer useful?  Yes

dasam

  • Mar 29th, 2007
 

If we are working with multiple inheritance, it is always better to make the base class as virtual inorder to avoid the multiple copies of the base class data. :)

  Was this answer useful?  Yes

daljit.mca

  • Aug 25th, 2010
 

Suppose you have two derived classes B and C that have a common base class A, and you also have another class D that inherits from B and C. You can declare the base class A as virtual to ensure that B and C share the same subobject of A.

Dj.Maan

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions