Broadly speaking, there are two general mechanisms used to achieve software reuse. These are inheritance, which captures the is-a relation, and composition, which captures the has-a relation. We will discuss each of them in more detail.