35 inheritance in python

 

'''

1. If you inheritance more than one class that is called multi inheritance

'''

class One():

    name = 'umamahesh'

    def add(self, a, b):

        print('sum is', a + b)


    def sub(self, a, b):

        print('sub is', a - b)


class Two():

    def colour(self):

        print('Blue')


class Three(One,Two):

    pass


ins = Three()

#print(dir(ins))

ins.colour()

ins.add(5,6)


Comments

Popular posts from this blog

1 PYTHON PROGRAMMING

4 Tuple data types

2 String data types