Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. In
object-oriented programming, a protocol or interface is what or how
unrelated objects use to communicate with each other. These are
definitions of methods and values which the objects agree upon in order
to cooperate. For example, in Java (where protocols are termed
interfaces), the Comparable interface specifies a method compareTo()
which implementing classes should implement. This means that a separate
sorting method, for example, can sort any object which implements the
Comparable interface, without having to know anything about the inner
nature of the class (except that two of these objects can be compared by
means of compareTo()). Some programming languages directly support
protocols or interfaces (Ada, C#, D, Java, Logtalk, Objective-C). Older
languages may also have features that can support the interface concept,
such as abstract base classes with pure virtual functions in C++, or
object-oriented features in Perl.