Question 136

Which statement about destructors in C++ is TRUE?

  1. ACalled only when the program starts
  2. BPrefixed with ~, no arguments and no return type
  3. CCan be overloaded
  4. DMust return void explicitly
Show answerHide answer

Correct answer: (B) Prefixed with ~, no arguments and no return type

Explanation

A class has exactly one destructor: ~ClassName().

From DSSSB TGT Computer Science Full Mock Test 2

This is question 136 of DSSSB TGT Computer Science Full Mock Test 2. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.