Circle Inheritance – A New Programming Approach to Achieve Higher Efficiency and Flexibility Illustrated With Java Language
Xinyi Zhou · SSRN Electronic Journal · 2019
Everyone who is familiar with the object oriented programming (OOP) concept/language like for example Java knows that inheritance is one of the 3 main concepts besides encapsulation and polymorphism. But unlike in C++ or Python, which are other OOP languages, Java does not allow multiple inheritance for the sake of simplicity. Thus every derived “son” class could extend resp. inherit only one base resp. “father” class' member variables and methods. Another problem with the inheritance concept is that if you override the base class methods e.g. public void walk(){....} in the derived class, then in the later inheritance line, the method walk() would be always logically belong to the derived class and not to the base class anymore. Now if you want to use both the newly added methods in the derived class and also the base class' original methods (before overridden by the derived class' methods), then multiple instantiation of both derived and base class need to be done (by “newing” those classes) which is not that efficient program wise and could be problematic when the coding project gets very big. So a new-to-the-world programming approach called “circle inheritance” will be introduced now to deal with above problems. Circle inheritance or circle extending is a concept to also allow the base class to reverse inherit resp. reverse extend (e.g. new Java keyword) the derived class' member variables and methods (beside the already existing way of inheritance of the derived “son” class extending the base “father” class' properties).