Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Define link and association. Discuss the role of link and association in object modeling with suitable example.

In object modeling, a link and an association are concepts used to represent relationships between classes and objects.

Link:

  • A link defines the relationship between two or more objects. It is considered as an instance of an association, representing a connection between instances of classes.
Example:
  • Classes: Person and Company Association: Ownership Link: Jhon owns stock in a company, Marry owns stock in a company, etc.
Explanation:
  • Suppose there’s an association called “Ownership” between Person and Company classes .Jhon, Marry, James, Sue, Kriti are instances of the Person class. The link is the specific connection between, for example, Jhon and the company he owns stock in.
Object Diagram:

2. Association:

  • An association is a group of links that relates objects from the same classes.
  • It represents a more generalized relationship between classes.

Example:

  • Classes: Person and Company
  • Association: Ownership

Explanation:

  • The association “Ownership” describes the relationship between instances of Person and Company classes.
  • It signifies that a person can own stock in zero or more companies, and a company may have several persons owning its stock.

Class Diagram:

Leave a Comment