views:

89

answers:

6

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.

A: 

B is the subject, A is the object, action is "inherit". So B acts on A, hence the direction of the arrow.

MK
A: 

I think the point is to express "generalization": A is a generalization of B.

This way the arrow expresses the same concept as in extension but goes the "right" way

fayoh
+3  A: 

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.

Péter Török
Inheritance is a form of dependency
krosenvold
Inheritance is material implication. `B => A` means "every B implies an A".
Apocalisp
A: 

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!

John Topley
+1  A: 

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 :-)

Christopher Oezbek
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.

Devon_C_Miller