when it comes to inheritance, my first reaction is: the non-technical example, the child inherits the father's performance ability, the child also has the extra music ability. Because of this first reaction, when I see: Comments inherit the news, it is a bit difficult to accept, why the comments inherit the news ah? The inheritance relationship should not be the same, like children inherit parents, birds inherit animals ( News category, such inheritance, the equivalent of birds inherit animals, but also easy to accept. ), how come a completely different thing, showing the inheritance relationship?
The beef brisket says "comments belong to a certain news, so comments inherit the news." Why
from the concept of inheritance, inheritance refers to the ability of a class (called a subclass, sub-interface) to inherit the functionality of another class (called the parent class, parent interface) and to increase its own new functionality.
comments Inherit news, sub-category comments belong to a piece of news, so, have all the properties of this news. Fully conforms to the concept of inheritance, subclasses have properties of the parent class.
From here, I understand the inheritance as belonging to the relationship. For example, a savings account and a checking account belong to a bank account; news belongs to a news category; a comment belongs to a news;
The previous understanding of inheritance has remained in some examples of image, and has not been implemented into the concept. But the concrete system, often does not have so the image, may combine the image the example first to understand, but finally must implement to the concept. After all, the example you remember is probably one-sided.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Re-understanding of inheritance