Generally speaking, do you manage to prevent LO's tummy bug spreading to the rest of the family?

For context: LO has been vomiting (only at night) since Friday night and on Sunday the Dr said it was likely a type of gastro and should clear up soon. Now it's Wednesday and still every night he is vomiting. I've been cleaning like mad and washing hands constantly and it hasn't spread to me, DH or my MIL who lives with us. The Dr this morning said it might be related to a cough he has, so I'm trying to work out if the fact it hasn't spread to us is because it isn't gastro at all, and if generally gastro is harder to prevent spreading than this.