In this lesson
- It starts with a question. A program tracks fifty boats, each with a name, a length and a fuel level. What is the cleanest structure?
- The idea you will find. The class is the mould; the object is the casting. — One Boat class, fifty boats, each with its own fuel level and the same set of actions. Because burning fuel is written inside the class, no other part of the program can change a boat’s fuel in a way the boat did not permit.
- Length. 5 short steps. Progress saves on this phone.
Part of Python: Classes & Objects
Classes and objects: bundling what a thing knows with what it can do.