Ace Your C++ Skills 2025 – Rock the ‘Thinking in C++’ Challenge!

Question: 1 / 565

Which of the following is a valid declaration for a destructor in a class named 'Item'?

void ~Item();

Item();

~Item();

A destructor is a function that is called when an object is destroyed. It is denoted by the '~' symbol followed by the class name. Option A is incorrect because the return type should not be specified for a destructor. Option B is incorrect because it is not a valid destructor syntax. Option D is incorrect because it is not a destructor declaration. Hence, the correct option is C.

Get further explanation with Examzify DeepDiveBeta

void Item();

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy