36 Multi Level inheritance in python

 '''

1. We can inherit a derived class from another derived class, 

this process is known as multilevel inheritance

2. Example :- We have three classes A, B and C, 

If you inheritance class A into class B and class B into class C This is called 

Multi Level inheritance.

'''


class A():

    def add(self, a, b):

        print('sum is', a + b)


    def sub(self, a, b):

        print('sub is', a - b)


class B(A):

    def colour(self):

        print('Blue')


class C(B):

    pass


ins = C()

print(dir(ins))

#ins.colour()


Comments

Popular posts from this blog

1 PYTHON PROGRAMMING

16 file handling in python

4 Tuple data types