A good puppy class normally lets the pups play together for only a very short time and then they're supposed to be paying attention to their handlers. By doing this the pups learn from an early age that being in the same room with other dogs isn't their cue to get all wiggly-butt and crazy everytime they see another dog.
You're also usually dealing with dogs that are approximately the same age and haven't developed too many bad habits yet as opposed to having a 4 month old and 3 year old reactive dog meeting on the street.