Learn to model real problems with classes and objects in Python — __init__ and self, instance versus class attributes, encapsulation, inheritance with super(), polymorphism and the dunder methods that make objects feel native. This course builds the object-oriented foundations assessed by the Python Institute PCAP certification.
Watch the free preview
Defining a class with __init__ and self — free to watch, no account needed.
What you'll learn
- Define classes with __init__ and self, and create objects from them
- Distinguish instance attributes from class attributes and use each correctly
- Encapsulate state using naming conventions and the property decorator
- Build inheritance hierarchies with super() and override methods polymorphically
- Implement dunder methods such as __str__, __repr__ and __add__ to integrate objects with Python
Syllabus
Classes & Objects — the Basics
Defining a class with __init__ and selfFree preview
Instance attributes versus class attributes
Encapsulation & Object Representation
Encapsulation with conventions and properties
Object representation with __str__ and __repr__
Inheritance & Polymorphism
Inheritance and super()
Polymorphism and method overriding
Dunder Methods & Composition
Operator overloading with dunder methods
Composition — building objects from objects
Lab — 10 Programming Exercises & Solutions
Programming Exercises 1–5
Programming Exercises 6–10