Dynamic Members:
- The specific functionality of Object must be defined as dynamic.
- We access dynamic members using object.
- We can create object for a class from static context.
Creating Object:
- Allocating memory by invoking constructor is called “Object creation”.
- Inside Object memory, dynamic variables will store.
Constructor:
- A method with pre-defined fixed identity( __init__ ).
- It must be executed in every object creation process.
self:
- It is not a keyword.
- It is the most recommended variable to define dynamic method and constructor.
- The definition as follows…
class Test:
def m1():
# static method
return
def m2(self):
# dynamic method
return
def __init__(self):
# constructor
return