Class

Domain: Programming Fundamentals

🎯 Motivation

When you have data and the functions that operate on it tightly coupled, a class bundles them together.

📋 Concrete Example

class Dog: def __init__(self, name): self.name = name; def bark(self): return self.name + ' says woof!' - data (name) and behaviour (bark) together.

🔗 Analogy

A blueprint for a house - the blueprint (class) defines the structure. You can build many houses (objects) from the same blueprint, each with different paint (data).