why constructor cannt be declar virtually?
why destructor cannt be overloaded?

Answers were Sorted based on User's Feedback



why constructor cannt be declar virtually? why destructor cannt be overloaded?..

Answer / subhashish sen

Constructor can't be virtual,becoz constructor is an entity
which initializes V-table(V-table contains addrress of all
the virtual functions of class).So if we declare constructor
as virtual the who will intialize V-table for this constructor.

Destructor can not be overloaded simply becoz we cant
provide argument to a destructor and also its going to
release the memory when an object goes out of scope.

Is This Answer Correct ?    20 Yes 0 No

why constructor cannt be declar virtually? why destructor cannt be overloaded?..

Answer / saurabh

destructors ae not overloaded as its mere function is to
release memory ,and the objects which are going to die
soon...and u r looking for other ways to kill those objects.

Is This Answer Correct ?    1 Yes 8 No

Post New Answer

More OOPS Interview Questions

What is oops in programming?

0 Answers  


how can we design a magic square in c++?or suggest me the basic idea of it.

3 Answers  


WAP find square root of any number (without using sqrt() )?

3 Answers  


how does a main() in C++ is different from main() in C?

7 Answers  


what is the difference between class and object?

9 Answers  






Which is better struts or spring?

0 Answers  


Why is encapsulation used?

0 Answers  


What is purpose of inheritance?

0 Answers  


what is the usage of clas templates

5 Answers  


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

2 Answers  


WRITE A SIMPLE C++ PROGRAM TO SWAP TWO NOS WITHOUT USING TEMP

2 Answers  


c++ program to swap the objects of two different classes

0 Answers  


Categories