Interview Questions   Tutorials   Discussions   Programs   Videos   

C++ - Why constructor cannot be declare virtually? why destructor cannot be overloaded?




289
views
asked marvit August 18, 2014 10:25 AM  

Why constructor cannot be declare virtually? why destructor cannot be overloaded?


           

1 Answers



 
answered By bhjahnavi   0  
Constructor can't be virtual, because constructor is an entity which initializes V-table(V-table contains address of all the virtual functions of class). So if we declare constructors as virtual then who will initialize V-table for this constructor.
 
Destructor can not be overloaded simply because we cant provide argument to a destructor and also its going to release the memory when an object goes out of scope.
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert