๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Java

[Java] ๋ฌต์‹œ์  ํด๋ž˜์Šค ํ˜• ๋ณ€ํ™˜๊ณผ ๋ฉ”์„œ๋“œ ์žฌ์ •์˜

by ์ฝ”๋”ฉํ•˜๋Š” ๋ถ•์–ด 2021. 2. 19.
๋ฐ˜์‘ํ˜•

โ–ถ ๋ฌต์‹œ์  ํด๋ž˜์Šค ํ˜• ๋ณ€ํ™˜๊ณผ ๋ฉ”์„œ๋“œ ์žฌ์ •์˜

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) + "์›์ž…๋‹ˆ๋‹ค.");
	}
}

<์‹คํ–‰ ๊ฒฐ๊ณผ>

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€