• In the parent class if we do not implement the logic for a method (As the method should be overridden in the child classes) then we make use of the abstract class
  • When we mark a method as abstract then the class that contains it also needs to be converted into a abstract class (Abstract class can have non abstract members)
  • When inheriting an abstract class the derived class must implement all the abstract members
  • Abstract classes cannot be instantiated
  • In Python Abstract class is created using the abc (Abstract Base Class) module
from abc import ABC, abstractmethod
 
# Abstract Class
class Shape(ABC):
    @abstractmethod
    def draw(self):
        pass
 
    def copy(self):
        print("Copying Shape to Clipboard")
 
class Circle(Shape):
    def draw(self):
        print("Drawing Circle")
 
class Main():
    circle = Circle()
    circle.draw()
    circle.copy()

Is it possible to make abstract classes in Python? - Stack Overflow