Single inheritance with constracor
#!single inheritance with constracor
class Faher:
sompotty="100 biga"
#constractor of parent class
def __init__(self,salary1):
self.salary=salary1
print("conostractor call hoye galo")
#now child class
class Son(Faher):
#instance method
def disp(self):
#parent ar conostractor er value ke child a instance method a ante pari
print("This is a sons instance method and the salary is",self.salary)
#Son class ar object banai
munna=Son("1 lakh")
#todo object bananor sathe sathe constractor call hoye """print("conostractor call hoye galo")"""" aita print nelo
#father er class veriable ke access korbo kivabe??
print(munna.sompotty) #aivabe korba
#son er instance method call kori
munna.disp()
Comments
Post a Comment