Walt Whitman's elegy, "O Captain! My Captain!" is written as an extended metaphor whose elegiac tone is evoked through the poem's rhythm and repetition and apostrophe. While there is no fixed meter, Whitman writes four longer lines followed by four short ones, creating a rhythm much like that of a heart beat.
The first two stanzas begin with apostrophe as the poet addresses his metaphoric "captain," President Abraham Lincoln; however, in the final stanza the poet recognizes that the captain of the "ship" of state--the country--has died even though the "victory," the end of the Civil War, has been won.
The opening couplets of Stanzas one and two establish positive moods as the poet celebrates the end of the Civil War in first stanza and the recognition of the American people--"the swaying mass"--who honor him for saving the Union in the second stanza. However, in each of these stanzas, the tone changes with the shorter lines which emphasize the poet's personal grief set against the greater victory. The repetition of the word heart certainly connotes the poet's personal grief:
But O heart! heart! heart!
O the bleeding drops of red
Where on the deck my Captain lies,
Fallen cold and dead.
The personal grief of the poet is further heightened in the second and third stanzas as Whitman addresses Lincoln both with the epithets of "my Captain" and "my father." The connotation of phrases suggests the shadow of this grief with such phrases as "grim and daring," "bugle trills," "bouquets and ribboned wreaths," "flag is flung," and "swaying mass."
Walt Whitman's "O Captain! My Captain!" expresses both the celebration of the country's victory and his personal lamentations of death as each stanza juxtaposes both exultations over the victory of President Lincoln with personal expressions of loss and grief.