Vaccination is a way of preparing the body's immune system to fight potential infection. By exposing the body to markers of the virus or bacteria, the white blood cells are able to recognise, memorise and fight these in the future.
Vaccinations are often deactivated or dead versions of the pathogen, meaning that vaccinations will not cause the disease in the person.