Classes are used as program modules
Some classes, such as our hello application, have just one or more method that will be executed as a program. Only one instance of these classes is created (by the interpreter).
Other classes are used to structure data, such as the previous example. Another example might be to have a class to represent type Complex. It would have
- variables to hold the real and imaginery parts of each instance
- a method called Complex to initialize those variables on creation
- methods called plus, subtract, and so on to operate on each instance of the complex class.
A computational class could create several instances of the class Complex and use them with the methods for arithmetic.