Why is it so that we can have virtual constructors but we
cannot have virtual destructors?

Answers were Sorted based on User's Feedback



Why is it so that we can have virtual constructors but we cannot have virtual destructors?..

Answer / rdl

We can have Virtual Destructor. We cannot have virtual
constructor, becoz, if the constructor is virtual, in
polymorphism, there may be a chance for the base class
constructor not to get executed. so the entire class will
not be available.

Is This Answer Correct ?    11 Yes 0 No

Why is it so that we can have virtual constructors but we cannot have virtual destructors?..

Answer / sachinmundhra

vptr gets initialize in constructor. So in that case we
cannot have virtual constructor.

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More OOPS Interview Questions

what is the new version of oops

0 Answers   Ignou,


advantage and disadvantage in c++>>oops and what are the questions ask for interview in c++>>oops. could you tell me or reply me

0 Answers  


What is encapsulation and abstraction? How are they implemented in C++?

0 Answers   Agilent, ZS Associates,


c++ is a pure object oriented programming or not?

5 Answers   Wipro,


difference between static and non-static variables?

2 Answers  






how do u initialize the constant variables

5 Answers   IBM, Siemens,


Advantage and disadvantage of routing in telecom sector

0 Answers  


design class for linked list and include constructor,destructor,insert option. node of form struct node { int data; struct node &ptr; }

0 Answers  


what is oppes

2 Answers  


Why multiple inheritance is not possible?

0 Answers  


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

0 Answers   TCS,


Why is oop useful?

0 Answers  


Categories