Skip to main content
Part 4 of 7 · Chapter 3 of 4

Bundling Data With Behaviour

A dictionary can hold a name and an age, but nothing stops you misspelling the key next time you use it. Define a class once, stamp out three objects from it, and give each its own values without repeating the shape.

Intermediate11 min read

Read first: Looking Things Up Instead of Counting Along


Make a free account to read on

Every chapter is free — an account is how your progress, XP, and streak follow you from your laptop to your phone, and how you show up on the leaderboard. No payment, no trial.