AlphaBeta
AlphaBeta

Reputation: 320

UML Class-Diagram, association: class -> interface

How can I visualize that a class only holds a reference to a interface of a specific class? Can i use associations between classes and interfaces ?

For example:

class A implements aInterface{
...
}

class B {
aInterface interfaceOfA;
...
}

Upvotes: 1

Views: 2050

Answers (2)

STheFox
STheFox

Reputation: 1498

yes, exactly like that.

Use the association aInterface interfaceOfA or use association A a because A implements aInterface and the class A has the methods written out

To visualize, draw an interface aInterface, and 2 classes, A and B. A implements aInterface, so there has to be an "implementline" from aInterface to A. B has association interfaceOfA, so there has to be an "associationline" from B to aInterface.

Clear?

Upvotes: 1

Vladimir
Vladimir

Reputation: 2119

UML Diagram can look like this:

enter image description here

Upvotes: 1

Related Questions