Built from the drawing
Objects as Houses
The analogy
An object is an actual house standing on an actual street. Two houses from the same drawing can be painted different colours and hold different families โ changing the curtains in one does not change the other. Each object keeps its own copy of the details.
Visualizer
Two houses, separate lives
step 1 / 4class House
colour: string
windows: number
address: string
the drawing โ nobody lives here
house1
colour: white
๐
house2
colour: white
๐
Two houses, same drawing, identical so far. Both white.
a = House("white")
b = House("white")
a.colour = "ochre"
print(a.colour) # "ochre"
print(b.colour) # "white" <- untouched
print(a is b) # False โ two objectsCheck yourself
You paint house A blue. What colour is house B?