Skip over navigation

Contents

Classes in C++

Terms

Introduction and Summary

Classes

Private  -  Functions and variables to which only the class member functions (and friends) have access.
Public  -  Functions, and rarely non-constant variables, that are directly accessible through an object.
Protected  -  The protected keyword behaves the same as the private keyword, with the exception that protected variables are directly accessible from within subclasses.
Object  -  An object is an instance of a class; it is a variable with all the functionality specified in the class's definition.
Data Member  -  A data member is a variable declared in a class definition.
Member Function  -  Functions that belong to a class and operate on a its data members.
Constructor  -  The constructor of a class is the function that is called automatically when a new object is created. It should initialize the class's data members and allocate any necessary memory.
Destructor  -  A destructor is the function called when an object goes out of scope. It should free memory dynamically allocated for the object's data members.
Friend  -  A friend function is a function that has access to all the class's data members and member functions, including those under the private and protected headings.
Inheritance  -  Inheritance is the property exhibited when a subclass is derived from a superclass. In particular it refers to the fact that an instance of the subclass has all of the data members and member functions of the superclass (and possibly more).
Base Class  -  A base class is a class from which another class, called a derived class, inherits components.
Derived Class  -  A derived class is a class which has inherited the components of another class, called the base class.
Class Template  -  A class which has one or more data members (and functions) of some unspecified data type. By defining a template, the programmer can create an object using any data type or types.
Composition  -  Composition is the use of an object as a member variable of another class as an alternative to creating a subclass.
Virtual  -  A C++ key word used to qualify functions and inheritance.

Follow Us