Heirarcy in object-oriented programming, is one of the seven fundamental principles of the object model. According to the principle, objects should be grouped in a hierarchical relationship, such that parent objects pass their methods and properties to child objects through a process called inheritance. See inheritance, object model, object-oriented programming.
Technipages Explains Hierarchy
A hierarchy is a structure within a program that profiles and rank entities according to their importance. A class is a user-defined data type, under which data means and member functions are included. The member function influences the data variables. All the functions & properties are the properties that make up a class, so when the classes are assembled, they form a hierarchy, also known as the class hierarchy. The class hierarchy is also known as the inheritance tree. A hierarchy is the classification of objects, and an object is the instance of a class.
The depth of a hierarchy is not hindered by the inheritance of instance variable ad method down the level, so the specializing behavior of a class is dependent on the depth of the hierarchy. For the definition of a method to be found, it has to be passed from the class of the receiving object, this is known as upcasting. So to override a method, the class is redefined.
Objects too posses hierarchies; however, an object hierarchy is a scenario wherein objects link themselves, the linkage forms an object hierarchy. Still, an object is an instance of a class, and object hierarchies are different from class hierarchies.
Common Uses of Hierarchy
- An object hierarchy shows the order and the linkage objects possess when they link themselves
- A class hierarchy is an assembly of classes, a class hierarchy is popularly known as the hierarchy tree, it shows the relationship and order of objects.
- The depth of a hierarchy does not hinder the inheritance of a class variable and method down the hierarchical level
Common Misuses of Hierarchy
- Both object and class hierarchy are the same, they perform the same role in a programming language.
- The depth of a hierarchy hinders the inheritance of instance variable and method down the level