You are likely referring to active immunity that can come from naturally acquiring the disease or vaccines. Both have T cells that fight pathogens and more antibodies are created to recognize viruses and the like and neutralize them. B cells can make more antibodies. There is a lot more detail to this question but hope it helps. Have a good day.