Object-Oriented Programming

Members

Inline - defined in the class declaration, or elsewhere with the keyword inline. The code is substituted in place of the method call

Private - visible only inside the class, and to friends. This is the default access for members in a class

Protected - visible inside the class, to friends, and to child classes

Public - visible outside the class

Static - belong to a class, not an individual instance of the class

Virtual - a child class can make its own body code for the method. Allows for dynamic binding of methods (polymorphism)

Example: virtual void m(int);

Pure virtual - a child class has to make its own body code for the method

Example: virtual void m(int) = 0;

A class containing a pure virtual function is an abstract class. An instance of such a class cannot be created, because it has undefined methods. An abstract class cannot contain any objects as data

Inheritance

Private - public and protected members of the parent class are private in the child class (the child class uses the parent class)

Protected - public and protected members of the parent class are protected in the child class (the child class uses the parent class)

Public - public and protected members of the parent class are public and protected (respectively) in the child class (the child class extends the parent class)

Friends

Gain access to all data and methods of a class - public, private, and protected

Are declared within the class declaration

Can be a class, a method, or a function

Are not inherited