Abstract Method Example
from abc import ABC,abstractmethod
class Shape(ABC):
@abstractmethod
def printAria(self): # ab sabhi cls ko printAria funtion apne andr define kr na hi hoga
return 0
class rectangle(Shape):
type="rectangle"
side=4
def __init__(self):
self.lenght=5
self.wirdth=6
# def printAria(self):
# return self.lenght*self.wirdth
rect=rectangle()
print(rect.printAria())
Comments
Post a Comment