As we have seen, interfaces can be used to tie together disparate classes that share some common features. For instance, all classes that implement the interface Comparable describe objects that can be linearly ordered by some internal parameter and hence sorted.
Notice that the property of being Comparable is orthogonal to any other features that the class may possess. Functions that operate on objects that implement the Comparable interface, such as the generic sorting functions we described, are not interested in these other features. Indeed, one can make a stronger statement and say that these functions can only access the Comparable portion of the objects that are passed to them.
In a more general sense, interfaces provide a limited public view of the overall capabilities of an object. We look at two examples to illustrate this idea.