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:
![](https://static.packt-cdn.com/products/9781838822323/graphics/assets/cecb5307-8e17-4e70-92d6-ac4927583d45.png)
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.