# Classes, Objects & __init__ — Python

Source: https://www.geekswithgeeks.com/en/python/py-classes-objects

> A class is a blueprint; an object is one instance built from it.

## __init__ and self

`class` defines the blueprint. `__init__` runs automatically when you create an object, and `self` refers to that specific object.

```python
class Dog:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def bark(self):
        return f"{self.name} says Woof!"

rex = Dog("Rex", 3)
print(rex.bark())   # Rex says Woof!
```

## Blueprint vs instance

Think of a class as a **cookie cutter** and objects as the **cookies** — same shape, different dough (data) each time.

## Why self?

`self` is just a convention name for the first parameter — Python passes the instance automatically; you never pass it yourself when calling `rex.bark()`.
