1.

Which among the following is correct syntax for the destructors?(a) classname()(b) ()classname(c) ~classname()(d) -classname()I got this question during an internship interview.I'm obligated to ask this question of Execution of Constructor or Destructor in section Constructors and Destructors of Object Oriented Programming

Answer»

Correct answer is (c) ~classname()

The explanation: The destructor MUST have same NAME as that of the CORRESPONDING CLASS. The class name should be preceded by the TILDE symbol (~).



Discussion

No Comment Found

Related InterviewSolutions