What is Static Constructor?

 Posted by Manicse on 10/12/2016 | Category: OOPS Interview questions | Views: 129 | Points: 40
Answer:

When constructors are used to set the value of a type's data at the time of construction, if we want the value of such static data is to be preserved regardless of how many objects of the type are created, we have to define the constructor with static keyword.

Example:
Class SimplestaticConstr

{
Static SimplestaticConstr()
{
//code inside this constructor
}
}


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response