We will illustrate the concept of classes with the example of rational numbers, that is, numbers of the form , where and are integers.
The following figure gives an example of a class declaration:
Figure 8.1: Example of a class declaration
We use rational numbers here only as an example of the class concept. For future work in Python with rational numbers, use the Python module fractions.