Saturday, March 7, 2020

How to write multiple classes and accessing them using python

class a:
    def __init__(self):
        print("this is initialisation")
    def fn1(self):
        print("this is This is inside fn1")


class b:
    def __init__(self):
        print("this is initialisation of b")
    def fn2(self):
        print("this is This is inside fn2")
   
       
buf=a()
buf.fn1()
c=b()
c.fn2()


output:
this is initialisation
this is This is inside fn1
this is initialisation of b
this is This is inside fn2

No comments:

Post a Comment

python class topic video