There are two parts of the immune system. The innate and the adaptive.
The innate part recognises common molecules present on the surface of bacteria and viruses and can recognise cells that are infected and can destroy them by producing an inflammatory response. This works for many infections.
Some bacteria and viruses have managed to evolve a way to avoid the innate immune system. In this case the adaptive immune system kicks in. This is the part that makes antibodies. This takes a little time. But once you have antibodies to detect the invading micro-organism the immune system can make an inflammatory resonse.
Comments