Sponsor Area

Classes In Python

Question
CBSEENCO12011587

Differentiate between static and dynamic binding in Python? Give suitable examples of each.

Solution


Static Binding

Dynamic Binding

Time of binding

happens during compilation

binding happens at run time

Actual object

Actual object is not used for binding

Actual object is used for binding

Example

Method overloading

Method overriding

Methods of binding

Private, static and final methods show static binding. Because they cannot be overridden.

Other than private, static and final methods show dynamic binding. Because they can be overridden.

Class

Type class

Object class