Lesson 31 of 34
Classes & Objects: உங்கள் சொந்த data typeClasses & Objects: Your Own Data Types
10 min 35 XP
class என்பது ஒரு வரைபடம் (blueprint). அதிலிருந்து உருவாக்கப்படும் ஒவ்வொன்றும் ஒரு object. உதாரணம்: Student என்பது class; Arun, Priya என்பவை objects.
A class is a blueprint. Each thing made from it is an object. Example: Student is the class; Arun and Priya are objects.
Example: edit me and press Run
Press Run to see the result here.__init__ என்பது object உருவாகும் போது தானாக இயங்கும். self என்பது “இந்த object” என்று பொருள். self.name = name என்பது பெயரை object-க்குள் சேமிக்கிறது.
__init__ runs automatically when an object is created. self means “this object”. self.name = name stores the name inside the object.
Example: edit me and press Run
Press Run to see the result here.class பெயர்களை பெரிய எழுத்தில் தொடங்குவது Python வழக்கம்: Student, BankAccount.
By convention, class names start with a capital letter: Student, BankAccount.