Also, I would like to add that Decorator pattern is an example where you can use composition over inheritance and add responsibilities to objects dynamically. The example of Decorator pattern is mentioned in Effective Java in the item "Favor Composition over Inheritance". To take an example from Java API; BufferedReader decorates a Reader (instead of extending FileReader, PipedReader, FilterReader etc) and hence has the capability to decorate any kind of Reader. Buffering functionality is attached to these readers at runtime which is the Decorator pattern.
Here extension by subclassing would be impractical.