1.

How the constructors and destructors can be differentiated?(a) Destructor have a return type but constructor doesn’t(b) Destructors can’t be defined by the programmer, but constructors can be defined(c) Destructors are preceded with a tilde (~) symbol, and constructor doesn’t(d) Destructors are same as constructors in syntaxI had been asked this question during an online interview.The origin of the question is Destructors topic in chapter Constructors and Destructors of Object Oriented Programming

Answer»

Correct option is (C) Destructors are preceded with a tilde (~) symbol, and constructor doesn’t

The best EXPLANATION: The destructors are preceded with the tilde (~) symbol. The NAME is same as that of the class. These also doesn’t have any return type.



Discussion

No Comment Found

Related InterviewSolutions