The following post demonstrates how to draw relationships between objects in a URL diagram. Mermaid syntax is also included.

Inheritance Link to heading

DerivedClass --|> BaseClass

DerivedClass inherits methods from BaseClass.

B -- A

Class A has a reference to B, B has reference to A.

One-way association Link to heading

B --> A

Class B has a reference to A, but not vice-versa.

Composition Link to heading

B --* A

Class A owns class B. B cannot exist indepedent from A. When A is destroyed, so does B.

public class Menu {
    private Button submitButton = new Button(); 
}

Aggregation Link to heading

B --o A

Class A owns class B. B can exist indepedent from A. E.g. reference comes from outside of the class.

public class SubPage { 
    private NotificationService _notificationService;
    
    public SubPage(NotificationService notificationService) { 
       this._notificationService = notificationService; 
    }
}

(mostly redundant to association [1])

Dependency Link to heading

Balance <.. ATM

ATM depends on Balance. Changing Balance affects whether ATM is able to withdraw money.

class ATM {
	public void Withdraw(Balance balance, int amount){
		if(balance.Value < amount){
			throw new Exception();
		}
		
		balance.Reduce(amount);
	}
}

The definition or implementation of the dependent classifier might change if the classifier at the arrowhead end is changed. [3]

Realization Link to heading

IService <|.. SpecificService

SpecificService implements IService interface.