Вопрос

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;
...
}
Это было полезно?

Решение

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?

Другие советы

UML Diagram can look like this:

enter image description here

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top