Constructor and Destructor

 Posted by Syedshakeer on 2/16/2009 | Category: C# Interview questions | Views: 11953


1. The Constructor is the first method that is run when an instance of a type is created. In visual basic a constructor is always Sub new ().

2. Constructor are use to initialize class and structure data before use. Constructor never returns a value and can be overridden to provide custom initialization functionality.

3. The constructor provides a way to set default values for data or perform other necessary functions before the object available for use.

Destructors are called just before an object is destroyed and can be used to run clean-up code. You can’t control when a destructor is called.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response