views:

22

answers:

2

Class Engine has "start(c:Component)" method. So do we need to draw an association between Engine and Component Class IF there is no "new Component()" inside Engine class. Thanks & regards

A: 

No, you do not in general need to have an association to a type even if the type is mentioned in a parameter. It entirely depends on if the state of an Engine maintains a relationship with one or more Components.

If the Component you passed around is only use locally in method start, then there is no real association that persists from one state (one method call) to the next.

ShiDoiSi
A: 

This is not an association, it´s a dependency relationship between the two. A dependency means that if the dependee (the Component in your case) changes the depender (the Engine) may become affected (maybe Engine::start was using a Component method that it is no longer available or that has changed its parameters)

Jordi Cabot