Class Diagram and Class Relationships
UML Representation


Link
- An instance of an association
- Exists between two or more objects

public class Member {
private Book book;
void issueBook(Book b) {
this.book = b;
b.setLender(this);
}
}
public class Book {
private Member member;
void setLender(Book b) {
member = b;
}
}
Qualified Association
Using a unique identifier to represent an association


public class League {
private Map players;
void addPlayer(String name, Player p) {
players.put(name, p);
p.addLeague(nickName, this);
}
}
public class Player {
private Map league;
void addLeague(String nickName, League l) {
league.put(l, nickName);
l.addPlayer(nickName, this);
}
}
Interface
A strict contract that is implemented by classes. Must override the defined methods


Abstract Class
A restricted base class that cannot be directly instantiated and is designed to inherited
- Reduces complexity
- Increases flexibility
