A vaccine is a solution containing all or part of a harmless version of a pathogen.
When a vaccine is injected the immune system responds these defensive proteins called antibodies.
If the same pathogen enters the body again in the future the antibodies are there to combat it and stop the growth before it can cause a disease
Vaccines have been prepared either to kill a specific pathogen or make the micro unable to grow
It has little but dangerous problems, the problem is that a failure in the process to kill or weaken a pathogen will result in the transmission of the disease.