The architect's drawing
Classes as Blueprints
The analogy
A class is a drawing of a house, not a house. You can hold one drawing and build a thousand houses from it — every house gets the same rooms in the same places, but each one is its own building with its own furniture. Nobody lives in the drawing.
Visualizer
One drawing, many houses
step 1 / 5class House
colour: string
windows: number
address: string
openDoor(): string
the drawing — nobody lives here
no objects yet
This is the drawing. Rooms, windows, a front door — all described, none of it built.
class House:
def __init__(self, colour):
self.colour = colour
def open_door(self):
return "creak"
# No house exists yet — this is only the drawing.Check yourself
You define class House. How many houses exist?