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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is there no multiple inheritance?

565


Where is pseudocode used?

563


What are the 4 main oop principles?

680


What is abstraction and encapsulation?

569


What is class encapsulation?

586






What are constructors in oop?

587


What is inheritance and how many types of inheritance?

614


What is overloading in oop?

572


to find out the minimum of two integer number of two different classes using friend function

1639


What is cohesion in oop?

621


What is inheritance in oop?

597


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

1652


How Do you Code Composition and Aggregation in C++ ?

24190


Explain virtual inheritance?

682


Write a c++ program to display pass and fail for three student using static member function

2812