It depends upon the immune system of a child. There are many children in day care centre or preschool, but as children often have low immunity, they do get contracted to any infection
once get exposed to that environment.
So, diet and lifestyle plays an important role in building the immunity against any infection!
Give your child a healthy food (green vegetables, fruits, nuts sp. walnut, almonds, give flaxseeds), increase intake of calcium which is in milk, milk products (strong bones makes the body strong), avoid giving junk food as they lowers the immunity, let the child play, keep the child happy (a happy child has more of so-called 'happy hormones') child should sleep 12-14hours a day (sleep rejuvenates and repairs the system).