René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Inheritance [JAVA]

Inheritance is one of two fundamental possibilites to build new classes from existing ones. The other one is aggregation.

extends

extends is the reserved word in java that defines a inheritance between classes:
class B {
  // some constructors,
  // methods and
  // variables,
}

class D extends B {
  // new constructors,
  // methods and
  // variables,
}
D is derived from B; it extends B with new methods, variables and constructors.
If a class does not explicitely extend another class, it implicitely extends the mother of all classes: java.lang.Object.

Synonyms

new class

Synonyms for the new class are
  • subclass
  • derived class
  • child class

old class

Synonyms for the old class are
  • superclass
  • base class
  • parent class

Inheriting a class

... yet to be finished ...