When you draw an inheritance diagram you usually go
Base ^ | Derived
Derived extends Base. So why does the arrow go up?
I thought it means that "Derived communicates with Base" by calling functions in it, but Base cannot call functions in Derived.
In UML the arrow is called a "Generalization" relationship and it only signals that each object of class Derived is also an object of class Base.
From the superstructure 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.”
Not really an answer though to the question :-)
AFAIK one of the reasons is notational consistency. All other directed arrows (dependency, aggregation, composition) points from the dependant to the dependee.
In inheritance, B depends on A but not vice versa. Thus the arrow points from B to A.
Read the arrow as "inherits from" and it makes sense. Or, if you like, think of it as the direction calls can be made.
I always think of it as B having more stuff in it then A (subclasses often have more methods than superclasses), hence B gets the wide end of the arrow and A gets the pointy end!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With