Classes and relationships


There are three types of classes shown in the UML diagrams: abstract classes, coclasses, and classes.
A coclass represents objects that you can directly create using the object declaration syntax in your development environment. In Visual Basic, this is written with the Dim pFoo As New FooObject syntax.
A class can't directly create new objects, but objects of a class can be created as a property of another class or by functions from another class.
An abstract class can't be used to create new objects; it is a specification for subclasses. An example is that a "line" could be an abstract class for "primary line" and "secondary line" classes. Abstract classes are important for developers who want to create a subclass of their own; they show which interfaces are required and which are optional for the type of class they are implementing. Required interfaces must be implemented on any subclass of the abstract class to ensure the new class behaves correctly in the ArcObjects system.
The example discussed here—primary and secondary line classes that each meet the specification of the abstract line class—is an illustration of type inheritance. Type inheritance is discussed in detail later in this section.

Relationships

Among abstract classes, coclasses, and classes, there are several types of class relationships possible—associations, type inheritance, instantiation, composition, and n-ary associations.
To keep the object model diagrams as simple and usable as possible, only key relationships, or associations, are shown.

Associations

Associations represent relationships between classes. They have defined multiplicities at both ends.
In this diagram, an owner can own one or many land parcels, and a land parcel can be owned by one or many owners.
A multiplicity is a constraint on the number of objects that can be associated with another object. This is the notation for multiplicities:
1—One and only one. Showing this multiplicity is optional; if none is shown, "1" is implied.
0..1—Zero or one.
M..N—From M to N (positive integers).
* or 0..*—From zero to any positive integer.
1..*—From one to any positive integer.

Type inheritance

Type inheritance defines specialized classes that share properties and methods with the superclass and have additional properties and methods.
This diagram shows that a primary line (creatable class) and secondary line (creatable class) are types of a line (abstract class).

Instantiation

Instantiation specifies that one object from one class has a method with which it creates an object from another class.
A pole object might have a method to create a transformer object.

Composition

Composition is a stronger form of aggregation in which objects from the "whole" class control the lifetime of objects from the "part" class.
A pole contains one or many crossarms. In this design, a crossarm can't be recycled when the pole is removed. The pole object controls the lifetime of the crossarm object.

N-ary association

An n-ary association specifies that more than two classes are associated. A diamond is placed at the intersection of the association branches.