The story "The Happy Prince" first appeared in The Happy Prince and Other Tales, a collection of children's stories by Oscar Wilde, published in May 1888. Although best known for his delightful drawing room comedies, this story blends fantasy and reality to show Wilde's more serious moral concerns.
The real elements of the story are income inequality and the lack of concern of the rich and powerful for the suffering of others, such as the woman only concerned about her ball gown rather than about the seamstress, or the Councillors concerned about self-aggrandizement rather than about helping the poor. The fantasy elements represent hope and charity. The Prince himself in life was not necessarily a bad person, but not a saintly one; as a gold statue he develops not only wisdom, but true moral goodness that is manifest in his willingness to sacrifice himself for others. His moral goodness also eventually inspires the sparrow to a similar transformation.
Although the talking statue and sparrow are fantasy elements, they exemplify the moral ideals of the story.