An army that learns
Your immune system defends you with white blood cells that patrol the blood and tissues. When a germ gets in, some of these cells learn to recognise it by its surface markers, called antigens — like identifying an intruder by a face.
B cells respond by making antibodies, proteins shaped to lock onto that specific invader and tag it for destruction. The first time, this learning is slow: it can take a week or more to build a full response, and meanwhile you feel ill.
Memory cells stay on guard
Once the infection is beaten, most of the responding cells die off, but a few become memory cells, which can survive for years or even decades. They hold the invader's description, ready for instant use.
If the same germ returns, memory cells trigger a response that is faster, stronger and often finishes the job before you notice any symptoms. That is the whole reason most people catch chickenpox only once, though the virus itself never leaves the world.
Memory can fade or be fooled
The system is powerful but not perfect. Influenza changes its surface markers every year, so last year's memory only partly matches — one reason flu returns each winter while measles, which barely changes, usually does not. Memory length varies too: protection from some infections lasts a lifetime, while other memories fade over the years, which is why booster vaccinations exist to refresh the guard.
Memory also explains allergies' opposite problem: sometimes the immune system remembers something harmless, like pollen, as if it were dangerous, and mounts a needless defence. The memory is specific — it recognises shapes, not general danger — which is why one illness rarely protects against a different one.

