«^»
4.2. Using a class declaration to define your own type

There are two main characteristics to a type:

For example, the type int refers to the set of integer values from some large negative value to some large positive value, together with operations such as addition and subtraction (denoted by + and -).

One approach to writing a program is to identify the objects of the problem that you need to represent in the program. Each object can be in a number of states (i.e., may possess one of a number of different values) and has a set of operations that can be performed on it.

Although some of these objects can be realised in your program by a variable of a type that is pre-defined in the programming language you are using, it would be useful to be able to define your own types to represent the other objects. The process of identifying the types needed for these objects is referred to as data abstraction.