UML Class (Person)
Person
- name: str
- age: int
+ __init__(name, age)
+ greet()
Learn how self refers to the current object, and how attributes are stored per instance.
__init__ runs when you create the object. self.x = … sticks data on it.
self is a reference to the current object. When you write self.name = "Max", you're storing a value in that specific object's storage, not shared across all objects.
Think of a class as a form template, and each instance as a filled-out form. self means "this form"—when you write on it, you're writing on THIS form, not every form.
Each instance stores independent attribute values in memory.