Lesson 32 of 34
Methods: Object செய்யும் செயல்கள்Methods: What Objects Can Do
10 min 35 XP
class-க்குள் எழுதும் functions-ஐ methods என்பார்கள். முதல் parameter எப்போதும் self. ஒரு method object-ன் தகவல்களைப் படிக்கவும் மாற்றவும் முடியும்.
Functions written inside a class are called methods. Their first parameter is always self. A method can read and change the object's data.
Example: edit me and press Run
Press Run to see the result here.__str__ method இருந்தால், print(object) அழகான உரையைக் காட்டும்.
With a __str__ method, print(object) shows friendly text.
Example: edit me and press Run
Press Run to see the result here.