Why contructors does not supports visual functions?

Editorial / Best Answer

Sandhya.Kishan  

  • Member Since Mar-2012 | Apr 17th, 2012


Constructor does not support virtual functions because we need an object to invoke a virtual method in the first place and more over constructors are used to initializing objects,which is a static type.Virtual functions are invoked on the dynamic type of the object,hence the object may not be properly initialized when a constructor call is made.Since the derived part of the object would not be initialized during the execution of base class constructor,hence calling any virtual method from base class constructor does not work well.

Showing Answers 1 - 3 of 3 Answers

Constructor does not support virtual functions because we need an object to invoke a virtual method in the first place and more over constructors are used to initializing objects,which is a static type.Virtual functions are invoked on the dynamic type of the object,hence the object may not be properly initialized when a constructor call is made.Since the derived part of the object would not be initialized during the execution of base class constructor,hence calling any virtual method from base class constructor does not work well.

  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