+2 votes
in Class 12 by kratos

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

1 Answer

+2 votes
by kratos
 
Best answer

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

...