How do we implement abstract method in Python? Support your answer with an example.

4 views

1 Answers

An abstract method is a method defined in a base class, but that may not provide any implementation. It is done by using the abc module in Python, import abc class Shape(object):

metaclass = abc.ABCMeta

@abc.abstractmethod

def method_to_implement(self, input):

“’’’’Method documentation

return

4 views