There are two basic kinds of relationships – an “is-a” relationship and a “has-a” relationship. In database design and object oriented program architecture, “has-a” is a relationship where one object "belongs" to another object, and behaves according to the rules of ownership. Multiple “has-a” relationships will combine to form a possessive hierarchy. This is contrasted with an “is-a” relationship which constitutes a different kind of hierarchy.
If Dog and Cat subclasses inherit directly from the mammal super class, the relationship is referred to as an "is-a" relationship because a cat is a mammal. When a subclass inherits from a superclass, it has all of the characteristics of the super class. Therefore, a dog and a cat are considered extensions of mammal.
It also is natural to think of objects as containing other objects. For example, a computer, which can be considered an object by itself, may also contain a hard drive and a video card, which are also considered valid objects. It is possible to open up the computer and remove the hard drive, so both the computer and the hard drive are considered objects. In this manner, objects are sometimes built, or composed, from other objects. This is called composition. A composition relationship is described as a "has-a" relationship.