Object-Oriented Programming (OOP)
Identify the correct definition of Destructor.
- A. A keyword used in a subclass to refer to members or methods of its immediate parent class.
- B. A mechanism where the method to be executed is determined at compile time based on the object's declared type.
- C. A mechanism where the method to be executed is determined at runtime rather than at compile time.
- D. A special method automatically invoked when an object is destroyed, used to release resources. ✓
Correct answer
D. A special method automatically invoked when an object is destroyed, used to release resources.
Explanation
Destructor refers to a special method automatically invoked when an object is destroyed, used to release resources.