A class is a blueprint. An object is a thing built from that blueprint.
One Dog class can make many dog objects — each with its own state. That single idea is the heart of OOP, and it's why this app has an Object Bench on the right: every object you create appears there as its own card.
| attribute | A piece of data an object stores (e.g. name, age). |
| access | private (🔒) = only the object's own methods can touch it — the safe default. public (🔓) = anything can read/change it directly with obj.attr, no protection. |
| constructor | The special method that runs when you build an object. In Python it's __init__ — it takes the attributes as parameters and sets them up. |
| getter | A method that reads a private attribute: get_age(). The safe way to look inside. |
| setter | A method that changes a private attribute: set_age(4). |
| new object | Building an object by calling the constructor: d1 = Dog("Rex", 3). This is instantiation. |
Encapsulation: make an attribute private and the only way in is its getter/setter — try to change it without a setter and you get an error. Make it public and you can change it directly with obj.attr, with no protection. That trade-off is the whole point.
OOP Blocks · Module 1 of the OOP_Blocks series · self-contained, no server. Private attributes use Python's self.__attr name-mangling convention.