1.

Why do we use static constructors?(a) To initialize the static members of class(b) To initialize all the members with static value(c) To delete the static members when not required(d) To clear all the static members initialized valuesI got this question in semester exam.My query is from Types of Constructors topic in portion Constructors and Destructors of Object Oriented Programming

Answer» RIGHT option is (a) To initialize the STATIC members of CLASS

For explanation: Static constructors help in initializing the static members of the class. This is PROVIDED because the static members are not considered to be property of the object, rather they are considered as the property of class.


Discussion

No Comment Found

Related InterviewSolutions