Tuesday, February 24, 2015

Why Constructor can't be declared Virtually? Why Destructor can't be Overloaded?

A ChildAction method is an action method thought its accessible from the View only, if you invoked this action via an URL then it prompts

This is what i found something very interesting about Constructor and Destructor.

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 becoz we cant provide argument to a destructor and also its going to release the memory when an object goes out of scope.


I hope it will help you somewhere down the line.
Keep coding and smiling Smile

To know moew MVC and WebApi Kindly go through with these links

Learn MVC & WCF and WebAPI


Post a Comment