Question OOP-CTOR-0002
EasyWhat is a destructor in C++?
- A.
A function that creates objects
- B.
A virtual constructor
- C.
Show answer and explanation
Answer: C
Its name is ~ClassName(), and it takes no arguments.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Constructors and Destructors question
What is a destructor in C++?
A function that creates objects
A virtual constructor
Answer: C
Its name is ~ClassName(), and it takes no arguments.
A special member function called when an object is destroyed, used to release resources
A function called before main