UML类图

此处输入图片的描述

依赖关系

此处输入图片的描述

1
2
3
4
5
6
public class Person {
public void doSomething(){
Card card = new Card();//局部变量
....
}
}
1
2
3
4
5
public class Person {
public void doSomething(Card card){//方法参数
....
}
}
1
2
3
4
5
6
public class Person {
public void doSomething(){
int id = Card.getId();//静态方法调用
...
}
}

关联关系

此处输入图片的描述

1
2
3
4
5
6
7
8
9
10
11
public class Person {
public Phone phone;
public void setPhone(Phone phone){
this.phone = phone;
}
public Phone getPhone(){
return phone;
}
}

聚合关系

此处输入图片的描述

1
2
3
4
5
6
7
public class Team {
public Person person;
public Team(Person person){
this.person = person;
}
}

组合关系

此处输入图片的描述

1
2
3
4
5
6
7
8
9
10
11
12
13
public class Person {
public Head head;
public Body body;
public Arm arm;
public Leg leg;
public Person(){
head = new Head();
body = new Body();
arm = new Arm();
leg = new Leg();
}
}

继承关系

此处输入图片的描述


------本文结束  感谢阅读------