Object Oriented Programming in Python
Lessons in this section
- Classes
Classes and objects, attributes and methods, self, the constructor, access modifiers and name mangling, class and static methods, and Enum.
- Inheritance
Parent and child classes, the five types of inheritance, inheriting and overriding, super(), and isinstance() and issubclass().
- Polymorphism
One name and many behaviours: method overriding, why Python has no overloading, dynamic binding, and operator overloading with magic methods.
- Abstraction
Hiding how something works behind what it does, abstract classes with the abc module, and abstract methods every child must implement.
- Encapsulation
Keeping data inside the class: data hiding, getters and setters, validation, and why Python uses @property instead.
- Advanced OOP
Inner classes, data classes with @dataclass, and the magic methods that make your objects work with print(), len(), in and for.