Classes in Python
How do we implement abstract method in python? Give an example for the same.
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
Sponsor Area
What is the significance of super() method? Give an example of the same.
How do we implement abstract method in python? Give an example for the same.
Sponsor Area
Sponsor Area