1.

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

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



Discussion

No Comment Found