1.

When and how many times a static constructor is called?(a) Created at time of object destruction(b) Called at first time when an object is created and only one time(c) Called at first time when an object is created and called with every new object creation(d) Called whenever an object go out of scopeI have been asked this question during an interview for a job.My question is from Types of Constructors in division Constructors and Destructors of Object Oriented Programming

Answer» RIGHT option is (B) Called at first time when an object is CREATED and only one time

The explanation: Those are called at very first CALL of object creation. That is called only one time because the value of static MEMBERS must be retained and continued from the time it gets created.


Discussion

No Comment Found

Related InterviewSolutions