Introduction to Hierarchy
This blog is part 2 on the object oriented programming in Matlab. Consider reading out previous blog first.
In classifying objects, hierarchy in the objects is a common occurrence, where subclasses and super-classes can be defined. In the example of a rectangle class, a superclass namely Shape can be defined, where the superclass provides a more broadly defined class for a shape, and rectangle a more narrowly defined class for a specific type of shape. We can extend our example, by including the creation of Triangle and Circle classes, which are also subclasses of the superclass Shape.