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.
Association (link) Link to heading
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.
Links Link to heading
- [1] https://nirajrules.wordpress.com/2011/07/15/association-vs-dependency-vs-aggregation-vs-composition/
- [2] https://blog.visual-paradigm.com/what-are-the-six-types-of-relationships-in-uml-class-diagrams/
- [3] https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/dd409437(v=vs.100)