Composition builds behavior by holding other objects (a "has-a" relationship) and delegating to them. Inheritance acquires behavior by extending a class ("is-a"). The advice "favor composition" exists because inheritance creates tight, fragile coupling to a base class, while composition stays flexible.
The problem with inheritance for reuse
<T> <T> {
{ add(x); }
T { remove(size() - ); }
}
