C++ Review Topics

Essay by InterSliceUniversity, Bachelor's March 2004

download word file, 11 pages 3.3

C++ fully supports object-oriented programming which includes the following:

Encapsulation is the property of being a self-contained unit. With encapsulation we can accomplish data hiding. Data hiding is the highly valued characteristic that an object can be used without the user knowing or caring how it works internally. C++ supports the properties of encapsulation through the creation of user-defined types, called classes.

Inheritance allows for the extension of an existing type. The new subclass derives from an existing type and is sometimes called a derived type.

Polymorphism is the ability of allowing C++ to support the concept that different objects do "the right thing". There is function polymorphism and class polymorphism. Poly means may, and morphous means form.

The ANSI Standard (American National Standards Institute) has created an international standard for C++. The C++ Standard is now also referred to as ISO (International Standards Organization) Standard. Also called the X3 Standard and ANSI/ISO Standard.

Text Book uses the ANSI standard term.

Using typedef

Rather than write

unsigned short int

many times, C++ enables you to create an alias for this phrase by using the keyword typedef, which stands for type definition. In effect, you are creating a synonym and not a new type.

typedef unsigned short int USHORT;

creates a new name USHORT that you can use anywhere instead of the longer form.


using namespace std;

typedef unsigned short int USHORT;

int main()


USHORT Width = 5;

USHORT Length;

Length = 10;

USHORT Area = Width * Length;

cout << "Width: " << Width << endl;

cout << "length: " << Length << endl;

cout << "Area: " << Area << endl;

return 0;


Enumerated Constants

Enumerated Constants enable you to create new types and then to define variables of those types whose...