Module 10: Object-Oriented Programming

Intermediate 19 chapters

117. Introduction to OOP

Meet object-oriented programming: what objects, classes and attributes are, why they help organise code, and how to make a first class and objects.

Intermediate25 min

118. Classes and Objects

Learn what a class is, how to create objects from it, and how objects keep their own data and behaviour. You will build small classes and use them step by step.

Intermediate25 min

119. Constructors

Learn how the __init__ constructor sets up a new object, how to use parameters and default values, and how to avoid common constructor mistakes.

Intermediate25 min

120. self Keyword

Understand what self means inside a class, how Python passes it automatically, and how to use it to read attributes, call other methods and return the object for chaining.

Intermediate25 min

121. Instance Variables

Learn how instance variables store data that belongs to each object, how to create, read, change and delete them, and how they differ from local variables.

Intermediate25 min

122. Class Variables

Learn what class variables are, how they are shared by all objects of a class, how they differ from instance variables, and the common traps with mutable values and shadowing.

Intermediate25 min

123. Instance Methods

Learn how to write instance methods, how `self` connects a method to its object, and how methods read, change and return object data.

Intermediate25 min

124. Class Methods

Learn how the `@classmethod` decorator works, what `cls` means, and how to use class methods as alternative constructors and to manage class-level data.

Intermediate25 min

125. Static Methods

Learn what static methods are, how @staticmethod works, and when to use a static method instead of an instance method, a class method or a plain function.

Intermediate25 min

126. Inheritance

Understand inheritance in Python: how a child class reuses a parent class, how to override methods, call super() and check relationships with isinstance and issubclass.

Intermediate30 min

127. Multiple Inheritance

Learn how a class can inherit from more than one parent, how Python decides the lookup order with the MRO, how the diamond problem is solved and how mixins are used.

Intermediate30 min

128. Multilevel Inheritance

Learn multilevel inheritance, where a class inherits from a child of another class, forming a chain such as grandparent, parent and child, and see how attributes, methods and super() work along the chain.

Intermediate25 min

129. Method Overriding

Learn how a child class can replace or extend a method it inherits from a parent class, and how super() lets you reuse the parent's version.

Intermediate25 min

130. Polymorphism

Understand polymorphism, where one interface works with many kinds of objects, through method overriding, duck typing and operator behaviour.

Intermediate25 min

131. Encapsulation

Learn how encapsulation bundles data with methods and protects it using naming conventions, name mangling, properties, getters and setters.

Intermediate25 min

132. Abstraction

Learn abstraction: hiding complex details behind simple interfaces, and using the abc module with abstract classes and abstract methods to force subclasses to follow a contract.

Intermediate25 min

133. Properties

Learn how the @property decorator turns methods into attributes, adds validation with setters, creates computed values, and keeps your class interface clean.

Intermediate25 min

134. Magic Methods

Discover magic (dunder) methods such as __init__, __str__, __repr__, __len__, __getitem__, __contains__ and __call__, and see how they let your own classes behave like built-in types.

Intermediate30 min

135. Operator Overloading

Learn how to give your classes their own meaning for operators such as +, -, *, ==, < and unary minus by defining methods like __add__, __eq__ and __lt__.

Intermediate30 min

Take the module test