why method takes self parameter in python
when objects are instantiated,the object itself is passed in to the self parameter of the method.
class test:
def m1(self):
print("hai")
t1=test()
t1.m1()
note:
- t1 passed to the self parameter of the m1( ) method
No comments:
Post a Comment