oopday4专题

oopDay4-继承,依赖,聚合(即extends与implements的使用)

Day4 1.继承,依赖,聚合 1.is a (继承的关系) ​ Pet ​ ↗ ↖ ​ Cat Dog 2.use a 使用(依赖的关系) public classTest{public void ting(Pet p){p.jiao();}} 3.has a 拥有(聚合的关系)—>涉及到一对一,多对一,一对多 ​ 学生 有 宠物 public class Student