I am reading a book that is on android but brushes over some java stuff in a minibook. I already read a book on Java and am aware of interfaces. The books says
The interface-implementing hierarchy (if you can call it a
“hierarchy”) cuts across the class-extension hierarchy. This idea is
illustrated in Figure 4-1, where I display class extensions vertically
and display interface implementations horizontally. (Android’s
KeyboardView class lives in the android.inputmethod service package.
Both KeyboardView and the homegrown MyListener class in Listing 4-3
implement Android’s OnClickListener interface.)
Burd, Barry (2011-11-14). Android Application Development All-in-One
For Dummies (p. 197). John Wiley and Sons. Kindle Edition.
Does the “cutting accross class hierchy” just mean that sibling classes both extend the interface… I don’t get what more are they pointing out with this diagram and saying it cuts across horizantly the class vertical heirchy in diagram 4-3… Please explain if there is special concepts deeper than what I got out of it…

Both the
MyListenerand theKeyboardView-classes implement theOnClickListener-interface. That makes both of those classesOnClickListeners.The idea is the following: Every class derives from a base-class (
Objectbeing the most basic class available). That makes every class anObject. Thinking in terms of OOP, the most abstract thing you can say about something is, that it is an object.Getting back to the interfaces, let’s assume you have two interfaces,
SingerandWriter. A person can be a singer, and a person can be a writer. But he/she can also be both.Implementing
Singerand/orWritertells you more about an object. Some code:By implementing the interfaces, you’re telling your code that this object is:
ObjectSingerWriterThis “cut’s through the class hierarchy” by providing more information about a class by not deriving from more classes, but by implementing interfaces.