Teaching your young child how to approach a dog is something you want to explain before your child meets their first strange dog.
This statement is true whether you have a dog or don't have a dog. Children often go to extremes when it comes to dogs. That is to say they either love all dogs and run up to new dogs with no fear or they fear all dogs. Really we want a calm reaction somewhere in the middle.
Even friendly dogs have been know to be startled by the unpredictable movements of a young child. Pair that fact with the fact that many dogs are the same height as young children and you have an accidental bite to the face as a very possible (and generally preventable) outcome.

Let your child know that dogs make wonderful pets and are generally kind, but a dog may be frightened by a stranger. Here are 3 things to teach your child...
1. Always ask the owner of a dog if you may pet the dog.
2. Always let the dog approach you. You may put your hand out, but not in the dog's face. Let the dog come to you. (This is a great time to explain to children that a dog can be afraid of new people and also that dogs learn about the world around them through smell.)
3. A child should never approach an unaccompanied dog you don't know.
For more tips on what to do and what the dog is thinking...