Unit- 3 Class and OOP
• MRO : MRO stands for Method Resolution Order. It is the order
in which Python looks for a method in a hierarchy of classes.
• It is possible to see MRO of a class using mro() method of the
class.
class A:
def process(self):
print('A process()')
class B:
pass
class C(A, B):
pass
obj = C()
[Link]()
print([Link]()) # print MRO for class C
Abstract Interface
Sr No.
Class
An abstract
features
developer's All methods of
class can an interface
1.
consist of are abstract
abstract as well
as concrete
methods
It is used when
It is used when all the feature
there are some need to be
2. common implemented
feature shared differently for
by all objects different
objects
Its developer
responsibility Any 3rd person
to create a will responsible
3. child class for for creating a
the features of child class
an abstract
class
It is It is
4. comparatively comparatively
fast slow