include
>>) ★★extend
>>)public class Person {
// 클래스의 속성("멤버 변수")에서 참조
private Car owns;
// getter, setter
public void setCar(Car car) {
this.owns = car;
}
public Car getCar() {
return this.owns;
}
}
public class Car {
...
// 연산의 "인자"(참조값)로 사용
public void fillGas(GasPump p) {
p.getGas(amount);
}
}
public class Computer {
private MainBoard mb;
private CPU c;
// 생성자
public Computer(MainBoard mb, CPU c) {
this.mb = mb;
this.c = c;
}
}
public class Computer {
private MainBoard mb;
private CPU c;
// 생성자
public Computer() {
this.mb = new MainBoard();
this.c = new CPU();
}
}
<<interface>>
표시http://jmlim.github.io/java/2018/12/06/java-aes256/