Lesson 4: Many objects, separate state
The real power of classes shows when you create many objects: each has its own attributes, and changing one doesn't touch the others. We'll also see how to keep objects in a list and loop over them.
Two accounts at the same bank: a deposit into Dana's account doesn't change Yossi's balance. Same class — separate state per object.
- state
- The collection of an object's attribute values at a given moment.
- objects in a list
- A list can hold objects — and you can loop over them with for.