Simulation with Classes and Inheritance

In the previous chapters, we described the entities we derived from libraries as objects with no further explanation. For example, an entity describing a web page in our previous chapter was an object with its own values and methods—bound functions that seem to have access to objects internals.

In fact, we can create our own structures by defining classes. In this chapter, we'll do exactly that—learn how to define and make the most of classes and their properties. Along the way, we will use classes to create a rather complex system and monitor its behavior—something that classes are very good for. Because of that, classes are used extensively in games, computer graphics...in fact, any type of task where creating specific entities seems useful. 

In this chapter, we will cover the following topics:

  • Writing a class and generating its instances
  • Using special methods of a class
  • Class inheritance
  • Build upon newly introduced syntaxes—data classes
  • Demystifying the relationship between classes and functions in Python
  • Creating a simplified dynamic model of an ecosystem using classes
  • Learning the basics of visualization in Python with the Matplotlib library
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.159.113