1.

Which among the following represents correct constructor?(a) ()classname(b) ~classname()(c) –classname()(d) classname()I have been asked this question during a job interview.I'm obligated to ask this question of Execution of Constructor or Destructor topic in chapter Constructors and Destructors of Object Oriented Programming

Answer»

Right OPTION is (d) CLASSNAME()

The EXPLANATION: The constructors must contain only the CLASS name. The class name is followed by the blank parenthesis or we can have PARAMETERS if some values are to be passed.



Discussion

No Comment Found

Related InterviewSolutions