Every time you get a cold, it's a different virus. Viruses mutate 1000 faster than bacteria, and some viruses, like HIV and colds (rhinovirus), actually can mutate WHILE STILL INSIDE YOU.
While your body takes stock and remembers viruses just like it does bacteria (with B cells), you never get the same cold again, because by the time you get cold #2, 3, 4, 1000...., it's a DIFFERENT mutation every single time.
HIV mutates in infected people every time they don't take their medication on time. Becomes immune to the medications very quickly.
This is one of the reasons why they will NEVER find a cure.
Also, viruses are immune to antibiotics, so there is no treatment for any viral disease, you just have to treat symptoms.
This is why flu can kill you.
Basically when they have a "vaccine" for a viral disease, like varicella, they are GIVING you the disease. It's not a vaccine in the true sense of the word. They are giving you a dose of live virus that has been mutated to not be very powerful, and they let it go in your body.
Then you get the disease, and your body makes antibodies to that. The T, B, and memory cells in your immune system take over at that point.
Hope this helps a little with understanding.