1.

In which access should a constructor be defined, so that object of the class can be created in any function?(a) Public(b) Protected(c) Private(d) Any access specifier will workI got this question in an international level competition.Question is taken from Constructors topic in division Constructors and Destructors of Object Oriented Programming

Answer» CORRECT answer is (a) Public

The explanation: Constructor function should be available to all the parts of PROGRAM where the OBJECT is to be created. Hence it is ADVISED to define it in public ACCESS, so that any other function is able to create objects.


Discussion

No Comment Found

Related InterviewSolutions