Answer:
If the characters have to be on the screen at the same time, then they shoot the different parts of the scene separately, and then merge them onto sort of a split screen, so we see them at the same time even though they were filmed at different times. That's what they did for some scenes in Parent Trap, for instance. If they don't have to be on the screen at the same time, then the actors just change clothes and makeup and shoot the scenes separately, like Van Dyke did in Mary Poppins, where he plays a main character and also the bank president.