OO Python Tutorials – Lesson 03 – Abstract Classes

Abstract classes are a way of defining a common interface for a set of subclasses that share some functionality. Abstract classes are useful when you want to specify what methods a class must implement, but not how they are implemented.

To create an abstract class in Python, you need to use the abc module, which provides the infrastructure for defining abstract base classes. You also need to use the @abstractmethod decorator, which marks a method as abstract and requires it to be overridden by the subclasses.

Source: https://www.youtube.com/watch?v=NACcFc-UZf0

Leave a Reply

Your email address will not be published. Required fields are marked *