Metaphor and allegory, as the answer above indicates, are similar; both of them make comparisons, but the primary difference between them is the depth of the comparison. William Golding's Lord of the Flies is a highly symbolic novel, and he uses both metaphor and allegory to make his point.
One of the most recognizable metaphors Golding uses in the novel is the beast. While the term beast is used to name many actual things in the story (such as creeping vines, pigs, a parachutist), Simon recognizes the truth that they are the beast. Golding is comparing what the boys have become--out-of-control savages who have no restraints or authority which they must obey--to beasts. In his conversation with the pig's head known as Lord of the Flies, Simon discovers this truth:
“Fancy thinking the Beast was something you could hunt and kill!” said the head. For a moment or two the forest and all the other dimly appreciated places echoed with the parody of laughter. “You knew, didn’t you? I’m part of you? Close, close, close! I’m the reason why it’s no go? Why things are what they are?”
That is the metaphor: the beast is them.
Golding's use of metaphor on a larger scale becomes an allegory. These proper English schoolboys, who do know how to live in a civilized manner and obey rules, are deposited on an island on which there are no adults. The only rules they have are those they make for themselves, but those are soon ignored or broken. They live without any restraints and they eventually become what Golding calls "savages." They destroy and they kill, things they would never do in their "real" worlds.
What these boys (and remember, they really are just children) do and become over the course of the novel is a picture of unchecked human nature. Their transformation from boy to savage is the allegory Golding uses to make this point.
Question: What is the difference between a metaphor and an allegory? Can you please include examples?
Answer: A metaphor is typically a phrase that is used as a comparison to seemingly unrelated objects or actions. A metaphor is a rhetorical trope that represents the first subject as being similar or equal to a second object or subject in any way.
An allegory is also a representation of comparisons but on a much deeper note. An allegory typically consist of a longer passage of comparisons than just a phrase; it also includes more details than a metaphor. An allegory is usually symbolically substituted for something else. A meaningful historical/geopolitical event or a wider abstract concept is usually the goal of an allegory. Metaphors are mainly used in language, whereas allegories can be used in language, painting, sculpting, etc.
EXAMPLES OF KNOWN METAPHORS: All the World's a stage, Killing him with Kindness, Frozen with fear, My stomach was a bottomless pit.
EXAMPLES OF KNOWN ALLEGORIES:
Example #1: In the novel, Lord of the Flies it provides a compelling allegory of human nature, illustrating the three sides of the psyche through its sharply-defined main characters.
Example # 2: A symbolic representation: The blindfolded figure with scales is an allegory of justice.