Glossary
Branches
In an inheritance hierarchy, 'branches' represent the subclasses that extend from a superclass, forming the lower levels of the tree structure.
Example:
From a 'Vehicle' superclass, 'Car', 'Motorcycle', and 'Truck' would be Branches, each inheriting common vehicle traits.
Inheritance Hierarchies
A structured organization of classes where subclasses inherit properties and behaviors from their superclasses, forming a tree-like relationship.
Example:
In a game, a 'Character' class might be the base, with 'PlayerCharacter' and 'NPC' as Inheritance Hierarchies extending from it, each with their own specialized abilities.
Polymorphism
The ability of an object to take on many forms, meaning a reference variable of a superclass type can refer to an object of any of its subclasses.
Example:
If you have a list of 'Animal' objects, you can add 'Dog', 'Cat', and 'Bird' objects to it, and when you call makeSound(), each object will perform its specific sound due to Polymorphism.
Root
In an inheritance hierarchy, the 'root' refers to the topmost superclass from which other classes directly or indirectly inherit.
Example:
If you imagine a family tree of animals, the 'Animal' class would be the Root, with all specific animal types branching out below it.
Subclass
A class that inherits properties and methods from another class, known as its superclass. It is also known as a child class or derived class.
Example:
The 'Dog' class is a Subclass of 'Animal', inheriting general animal characteristics but also having its own unique behaviors like bark().
Superclass
A class whose properties and methods are inherited by other classes. It is also known as a parent class or base class.
Example:
The 'Shape' class is a Superclass for 'Circle' and 'Square', providing common methods like calculateArea() that its subclasses will implement.
Type Diagram / Hierarchy Tree
A visual representation that illustrates the relationships between classes in an inheritance hierarchy, showing which classes extend from others.
Example:
A Type Diagram for a banking system might show 'Account' at the top, with 'SavingsAccount' and 'CheckingAccount' extending from it, clearly mapping their relationships.