why constructor cannt be declar virtually?
why destructor cannt be overloaded?
Answers were Sorted based on User's Feedback
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 |
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 |
What is oops in programming?
how can we design a magic square in c++?or suggest me the basic idea of it.
WAP find square root of any number (without using sqrt() )?
how does a main() in C++ is different from main() in C?
what is the difference between class and object?
Which is better struts or spring?
Why is encapsulation used?
What is purpose of inheritance?
what is the usage of clas templates
Why is it so that we can have virtual constructors but we cannot have virtual destructors?
WRITE A SIMPLE C++ PROGRAM TO SWAP TWO NOS WITHOUT USING TEMP
c++ program to swap the objects of two different classes