Coba jelasin Asosiasi antar class dari Class (élmu komputer) dalam bahasa sunda dong

In object-oriented design an association between two classes is a type of a link between the corresponding objects. A (two-way) association between classes A and B describes a relationship between éach object of class A and some objects of class B, and vice versa. Associations are often named with a verb, such as "subscribes-to".

An association role describes the role of an instance of a class when the instance participates in an association. An association role is related to éach end of the association. The role describes an instance of a class from the point of view of a situation in which the instance participates in the association. For example, a "subscriber" role describes instances of the class "Person" when it participates in a "subscribes-to" relationship with the class "Magazine". Also, a "Magazine" has the "subscribed magazine" role when the subscribers subscribe-to it.

Association role multiplicity describes how many instances correspond to éach instance of the other class(es) of the association. Common multiplicities are "0..1", "1..1", "1..*" and "0..*", where the "*" specifies any number of instances.

There are some special kinds of associations between classes. Composition between class A and class B describes a "part-of" relationship where instances of class B have shorter lifetime than the lifetime of the corresponding instances of the enclosing class. Class B is said to be a part of class A. This is often implemented in programming languages by allocating the data storage of instances of class A to contain a representation of instances of class B. Aggregation is like composition in that it describes that instances of a class are part of instances of the other class, but the constraint on lifetime of the instances is not required. The implementation of aggregation is often via a pointer or reference to the contained instance. In both cases, method implementations of the enclosing class can invoke methods of the part class.