1.

Which among the following is true for static constructor?(a) Static constructors are called with every new object(b) Static constructors are used initialize data members to zero always(c) Static constructors can’t be parameterized constructors(d) Static constructors can be used to initialize the non-static members alsoI got this question in class test.The doubt is from Types of Constructors in portion Constructors and Destructors of Object Oriented Programming

Answer»

The correct CHOICE is (c) STATIC constructors can’t be parameterized constructors

The BEST I can explain: Static constructors can’t be parameterized constructors. Those are used to INITIALIZE the value of static members only. And that must be a definite value. Accepting arguments may MAKE it possible that static members loses their value with every new object being created.



Discussion

No Comment Found

Related InterviewSolutions