During the ghost's conversation with Hamlet in Act I, Scene V, there are several uses of synedoche:a figure of speech by which a more comprehensive term is used for a less comprehensive or vice versa, as whole for part or part for whole, e.g. ‘There were six guns out on the moor’ where ‘guns’ stands for shooters; and ‘Oxford won the match’, where ‘Oxford’ stands for ‘the Oxford eleven’. In Lines 41-43, Act I, Scene V, the ghost first tells Hamlet that he was murdered and " So the whole ear of Denmark/ Is by a forged process of my death /Rankly abused. " In the quotation The "ear" stands for the country of Denmark. The ghost continues in Lines 87-90,"Let not the royal bed of Denmark be A couch for luxury and damned incest." Here the ghost is discussing the marriage of Gertrude and Claudius and uses the term royal bed of Denmark" to represent the marriage. If you look at the rest of the play you will find other example of synedoche.
Synecdoche is seen in Act I.v of Hamlet when the ghost says that he was killed by his brother's hand. THe word hand stands in place of the whole person: Claudius.