C++ and OOP Terminology

Class and Object
A class is a template (not much unlike struct or union) which defines the data and code members of an object. This class is used to make objects. Objects are the instances or occurances of a class. Objects are created from classes, and the object is the existing thing at runtime (like a variable).

Inheritance
Inheritance is the ability for one object to be based upon another object. An example of this could be a 'Transportation' object. This basic object contains items like passenger capacity and speed. From this object, we may create a new class called car, which also has the ability to keep track of power steering (yes or no). The new car object inherits the code to manage speed from the base class.

Polymorphism
Polymorphism is the ability to apply a standard interface to an object. For example, just about every electronic device has an on/off switch which performs the same task. The interface to us is simple and straight forward. What happens inside the electronic device will vary greatly between devices.

What this means to a C++ programmer is that objects have functions assigned to them, and similar objects (or derived objects) will implement the same function name to accomplish the same task, while the mechanics of how it is done may be greatly different.

For example, imaging two objects, one handles input from a keyboard, and the other handles input from a modem. Both objects implement a function called GetLine. This GetLine function does the same job from the application viewpoint, it gets a line from an input device. Our application doesn't have to care if the user is at the keyboard, or across the country via modem. Chances are that our keyboard object and modem object are both derived from a standard 'Input' object or base object. All similar objects derived from the Input object would have to provide the GetLine function.

Encapsulation
Encapsulation refers to the ability to tighly bind code and data together. In C++, functions can be defined inside the object, making them just as much a part of the object as the data members of the object. Encapsulation helps promote the idea and concept of a self-sufficient object.