InterviewSolution
Saved Bookmarks
| 1. |
When is the static constructor called?(a) After the first instance is created(b) Before default constructor call of first instance(c) Before first instance is created(d) At time of creation of first instanceI had been asked this question in a job interview.My question is taken from Types of Constructors in division Constructors and Destructors of Object Oriented Programming |
|
Answer» RIGHT choice is (c) Before FIRST instance is created The best explanation: The static constructor is called before creation of the first instance of that class. This is DONE so that even the first instance can use the static value of the static members of the class and manipulate as required. |
|