1.

What are singleton objects?(a) The only two objects of a class throughout the program(b) The only object of a class throughout the program(c) The objects that are alive throughout the program(d) The objects that are created and then deleted without useI had been asked this question in examination.My enquiry is from Object Use topic in division Object of Object Oriented Programming

Answer»

The CORRECT option is (B) The only object of a class THROUGHOUT the program

For explanation: If a class has only ONE object created and that is the only object of the class. Then the object is known as the SINGLETON object. But only if that object is the only object of the class and no other object is created for that class.



Discussion

No Comment Found

Related InterviewSolutions