I was looking at Android development documentation, and I saw this:
public abstract class Buffer
extends Object
Known Direct Subclasses:
ByteBuffer, CharBuffer, DoubleBuffer, FloatBuffer, IntBuffer, LongBuffer, ShortBuffer
Known Indirect Subclasses:
MappedByteBuffer
Buffer
is a abstract class that cannot be instantiated.
It inherits (extends) Object
.
But I am confused about the direct and indirect subclasses. My best guess would be: Direct extend directly from the superclass. Indirect extends from a superclass that directly extends the class in question.
Many thanks for any suggestions,
■ The direct superclass is the superclass from which the. subclass explicitly inherits. ■ An indirect superclass is any class above the direct. superclass in the class hierarchy. ■ The Java class hierarchy begins with class Object (in.
Definition: A subclass is a class that derives from another class. A subclass inherits state and behavior from all of its ancestors. The term superclass refers to a class's direct ancestor as well as all of its ascendant classes.
Definitions: A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class).
Subclasses are classes that can be derived from a parent class by adding some functionality, such as new object variables or new methods. In terms of automaton theory, a subclass adds new states and new rows to the state transition table.
You are correct. A known direct relationship implies that the class is the immediate ancestor. A known in-direct relationship implies that the class is known to be a sub-class, but it may in fact be many levels below the parent.
Given class A
:
class B extends A // B is direct subclass of A
class C extends B // C is indirect subclass of A
class D extends C // D is indirect subclass of A
you get the point.
Another way to look at it is using this inheritance chain graph (A is the superclass, the rest inherits):
A->B->C->D
B is a direct subclass of A, the rest are indirect subclass of A.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With