Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should a basic class hierarchy be constructed? [closed]

Tags:

People also ask

How do you show class hierarchy?

To view a type in the Type Hierarchy view: Through the "Open Type in Hierarchy" wizard: Press Ctrl+Shift+H -or- from the Menu Bar go to Navigate | Open Type in Hierarchy. The "Open Type in Hierarchy" dialog is displayed.

What is class hierarchy and example?

A class hierarchy or inheritance tree in computer science is a classification of object types, denoting objects as the instantiations of classes (class is like a blueprint, the object is what is built from that blueprint) inter-relating the various classes by relationships such as "inherits", "extends", "is an ...

What is hierarchy of classes in inheritance?

Hierarchical inheritance is a kind of inheritance where more than one class is inherited from a single parent or base class. Especially those features which are common in the parent class is also common with the base class.

What does a class hierarchy do?

A class hierarchy represents a set of hierarchically organized concepts. Base classes act typically as interfaces. They are two uses for interfaces. One is called implementation inheritance and the other interface inheritance.


I know how to code and use simple classes, and I even know how inheritance works and how to use it. However, there's a very limited amount of guides on how to actually design the structure of your class hierarchy, or even how to design a simple class? Also, when and why should I inherit (or use) a class?

So I'm not really asking about how, I'm asking when and why. Example codes are always a good way to learn, so I would appreciate them. Also, emphasize the progress of designing rather than simply giving one sentence on when and why.

I program mainly in C++, C# and Python, but I'll probably understand the simple examples in most languages.

If any of the terms seem mixed up or so, feel free to edit my question. I'm not a native and I'm not sure of all the words.