
A Gentle Introduction to Object Oriented Programming 5.9
python boxmethods.py
30
62
Hey, I am box! with volume 30mm, and surface area 62mm.
I am being reset
Reset complete
8
Hey, I am box! with volume 8mm, and surface area 24mm.
I am resizing
Hey, I am box! with volume 48mm, and surface area 42mm.
5.5.2 The Self
Class methods have only one specic difference from ordinary functions, they must
have an extra rst name that has to be added to the beginning of the parameter list,
but you do not give a value for this parameter, when you call the method, Python
will provide it. This particular variable refers to the object itself and by convention,
it is gi ...