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

i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<<k; } //please comment on the output

0 Answers  


What is the full form of oops?

0 Answers  


What is debug class?what is trace class? What differences are between them? With examples.

0 Answers  


What is oops and its features?

0 Answers  


i have to create a view in SQL as like in ORACLE DATA EXPRESS EDITION

2 Answers   CTS,






How to overload postfix operator in c++

1 Answers   Mphasis,


What is object and example?

0 Answers  


if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?

1 Answers  


why c++ is called OOPS? waht is inherutance? what is compiler?

5 Answers  


i ahve v low % in 12th n BSC which is aroun 50 coz science was imposed on me......nw m doin MCA n my aggregate in above 74%,what shud i say if asked about low previous percentage??????

4 Answers  


What does and I oop mean?

0 Answers  


Why do we use polymorphism?

0 Answers  


Categories