SE450: Basics: Aggregation (Reference) [38/63] Previous pageContentsNext page

file:Person.java [source] [doc-public] [doc-private]
01
02
03
04
05
06
07
package basics.aggregation;
final class Person {
  //stdlib.Trace.graphvizShowSteps (true); stdlib.Trace.run ();
  final private String name;
  public Person(String name) { this.name = name; }
  public String toString() { return "Person(" + name + ")"; };
}

Reference to objects of another class:

   +--------+   name  +--------+
   | Person |<>------>| String |
   +--------+         +--------+

In UML, this is called aggregation.

Note that the aggregation refers to the instances of the class, not the class itself.

Class diagrams are static (describe the program text).

Previous pageContentsNext page