Solved Problem#PYTHON#6472
Problem Statement - B02D-2016D
How do we implement abstract method in python? Give an example for the same.
Solution
Solved Problem Understanding
Abstract method: An unimplemented method is called an abstract method. When an abstract method is declared in a base class, the derived class has to either define the method or raise “NotImplementedError”
class Shape(object): def findArea(self): pass class Square(Shape): def __init__(self,side): self.side = side def findArea(self): return self.side * self.side