- Education Resources
PrivacyContact Introduction to C++ Programming
Learn C++ in step-by-step lessons.
Classes: Creating classes
Introduction to Classes: Terms
- Object: combines data(attributes, properties, variables) and member functions(methods).
- Encapsulation: combining data and code into a single object
- Data hiding: making attributes (variables) private and controlling access to them with methods (functions)
- Class: code that specifies the attributes *variables) and member functions (methods)
- Instance: An object created from the class. (Using a constructor)
- Private: (access specifier) Private attributes and methods can only be used inside the class definition.
- Public: (access specifier) Public attributes and methods are ones that can be accessed outside the class definition.
- Accessors: Accessors retrieve values from the class, usually named get___, also called getter functions
- Mutators: Mutators change the values in the class, usually named set___, also called setter functions.
- Constructor: Method with same name as class, used to give initial values to the attributes.
- Destructor: Member function with same name as the class with a ~ in front. The destructor is called when the object is destroyed.
- Overloaded constructors: Constructors can be written with different arguments. Usually there is one constructor with no arguments (the default constructor) and ones with different attributes given values.
Please study the material at each of the links below.
- Expanding on the rectangle class
- More methods for rectangle class
Glossary for classes lessonFull Glossary