Children learn by example and they are always watching. If a child is misbehaving In public, the child is still watching. How does my parent (my role model) solve their problems? By yelling? By hitting? Or by talking?
And to counter anecdote with anecdote, I have seen plenty of misbehaving children in public with parents frantically trying to control them by yelling at them or spanking them, and it usually only results in even louder crying and more defiance.
Children misbehave as a kind of experimentation. At least some bad behavior is unavoidable, and it is an excellent chance for parents to give their children a lesson in conflict resolution.