OOP
Classes, objects, inheritance and polymorphism, with Python examples.
11 notes · 46 min total
- 1Classes and ObjectsWhat classes and objects are in Python, where attributes live, and how __new__ and __init__ build an object.5 min
- 2Class Keywords and ConceptsHow self, class attributes, static and class methods, Final, super() and access conventions work in Python classes.6 min
- 3EncapsulationHow to hide an object's data and control access to it in Python with naming conventions, getters/setters and @property.3 min
- 4AbstractionHow abstraction hides implementation behind a contract, and how Python's ABC and @abstractmethod enforce it.4 min
- 5InheritanceHow Python classes reuse code through inheritance, how super() and the MRO work, and how the diamond problem is resolved.4 min
- 6PolymorphismHow one interface can behave differently per object in Python: duck typing, method overriding and operator overloading.3 min
- 7Relationships: Association, Aggregation, CompositionHow classes relate (is-a vs has-a), and how to tell association, aggregation and composition apart in UML and code.4 min
- 8Dunder Methods and @propertyWhich dunder methods Python calls for printing, comparing, adding and len(), and how @property gives computed attributes.4 min
- 9DecoratorsHow Python decorators wrap functions, and when to use @classmethod, @staticmethod, @property, @dataclass and your own.4 min
- 10OOP Principles RecapA one-page Python recap of the four OOP pillars plus interfaces with abstract base classes, tying the OOP lessons together.4 min
- 11OOP Practice ExercisesThree Python exercises (library, animals, bank) that combine dunder methods, abstraction, encapsulation and Singleton.5 min