๋ฐ์ํ
โถ ๋ฌต์์ ํด๋์ค ํ ๋ณํ๊ณผ ๋ฉ์๋ ์ฌ์ ์
package inheritance;
public class OverridingTest2 {
public static void main(String[] args) {
Customer vc = new VIPCustomer(10030, "๋๋ชฐ๋ผ", 2000); // VIP ๊ณ ๊ฐ ์์ฑ
vc.bonusPoint = 1000;
System.out.println(vc.getCustomerName() + " ๋์ด ์ง๋ถํด์ผ ํ๋ ๊ธ์ก์ " + vc.calcPrice(10000) + "์์
๋๋ค.");
}
}
<์คํ ๊ฒฐ๊ณผ>
๋ฐ์ํ
'Java' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Java] ๋คํ์ฑ (0) | 2021.02.19 |
---|---|
[Java] ๊ฐ์ ๋ฉ์๋ (0) | 2021.02.19 |
[Java] ๋ฉ์๋ ์ค๋ฒ๋ผ์ด๋ฉ (0) | 2021.02.19 |
[Java] ๋ถ๋ชจ๋ฅผ ๋ถ๋ฅด๋ ์์ฝ์ด, super (0) | 2021.02.19 |
[Java] ์์ (0) | 2021.02.19 |
๋๊ธ