为什么箭头继承?
问题描述:
答
AFAIK一个原因是符号一致性。所有其他定向箭头(依赖项,聚合,合成)都从依赖项指向依赖项。
在继承中,B依赖于A,但反之亦然。因此,箭头指向从B到A.
答
B是主语,A是客体,动作是“继承”。所以B作用于A,因此箭头的方向。
答
我认为这一点是为了表达“泛化”:一个是B.
这样的箭头表示相同的概念在延伸的推广,但去了“正确”的方式
答
我一直认为它有更多的东西在它然后A(子类通常有比超类更多的方法),因此B获得箭头的宽端和A获得尖尖的结局!
答
在UML中,箭头被称为“泛化”关系,它仅表示Derived类的每个对象也是类Base的对象。
从上层建筑2.1.2:
A Generalization is shown as a line with a hollow triangle as an
arrowhead between the symbols representing the involved classifiers.
The arrowhead points to the symbol representing the general
classifier. This notation is referred to as the “separate target style.”
不是一个真正的答案,虽然这个问题:-)
答
阅读箭头“继承自”,这是有道理的。或者,如果您愿意,可以将其视为可以拨打电话的方向。
+0
我同意你的第一部分,但关于第二部分,以下是可能的:[调用基类 的派生类函数](http://stackoverflow.com/a/4869284/2361131) – harshvchawla 2017-05-05 04:53:40
继承是一种依赖形式 – krosenvold 2010-03-18 16:31:22
继承是物质含义。 'B => A'的意思是“每个B意味着一个A”。 – Apocalisp 2010-03-19 16:33:50