Key Concepts

Review core concepts you need to learn to master this subject

Destructor

City::~City() { // Any final cleanup }

For a C++ class, a destructor is a special method that handles object destruction, generally focused on preventing memory leaks. Class destructors don’t take arguments as input and their names are always preceded by a tilde ~.

Classes and Objects
Lesson 1 of 1

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo