Learn
Hooray! You’ve learned the basics of classes and objects in C++:
- Classes are user-defined types.
- Objects are instances of classes.
- Class members are the data attributes and functions inside of a class.
- Creating a new object from a class is called instantiation.
- Class members can be designated as either
private
orpublic
— they areprivate
by default. - You can create a constructor to instantiate objects in a particular way.
- A destructor allows you to execute any cleanup necessary before an object gets destroyed.
Instructions
We’ve added a few files so you can create some of your own classes and objects!
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.