Single inheritance in python
#! single inheritance in python
class Father:
money=2000
def instance(self,mon1):
mon=mon1
print("It is instance method",mon)
@classmethod
def Classmehod(cls,currency1):
currency=currency1
print("This is class method and the currency is ",currency)
@staticmethod
def static(experiment1):
experiment=experiment1
print("This is static mathod and experiment ",experiment)
class Son(Father):
#instancemathod
def instancemethod(self):
print("This is child classs instance method")
#?child class ar object banai
munna=Son()
#? aibar child ar object diye parent er sompottyke call kori
#parent er class variable ke call korte parbo
print(munna.money)
#parent er instance mathod ke call korte parbo/argument deta parbo
munna.instance("Valo")
#parnt ar class mathod ke call korte parbo/argument deta parbo
munna.Classmehod("doller")
#parentar static mathod ke call korte parbo
munna.static("Successful")
Comments
Post a Comment