728x90
๋ฐ˜์‘ํ˜•

Overriding 1

[์ž๋ฐ”] ์˜ค๋ฒ„๋กœ๋”ฉ(Overloading)๊ณผ ์˜ค๋ฒ„๋ผ์ด๋”ฉ(Overriding)์˜ ์ฐจ์ด์ 

๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์—์„œ ๋‹คํ˜•์„ฑ์„ ์„ค๋ช…ํ•  ๋•Œ, ํ•˜๋‚˜์˜ ํด๋ž˜์Šค ๋‚ด๋ถ€์— ๊ฐ™์€ ์ด๋ฆ„์˜ ๊ธฐ๋Šฅ์„ ์—ฌ๋Ÿฌ ๊ฐœ ์ •์˜ํ•˜๊ฑฐ๋‚˜ ์ƒ์œ„ ํด๋ž˜์Šค์˜ ๊ธฐ๋Šฅ์„ ํ•˜์œ„ ํด๋ž˜์Šค์—์„œ ๋‹ค์‹œ ์ •์˜ํ•˜๋Š” ๊ฒƒ, ์ฆ‰, ์˜ค๋ฒ„๋ผ์ด๋”ฉ๊ณผ ์˜ค๋ฒ„๋กœ๋”ฉ์— ๋Œ€ํ•ด์„œ ๊ฐ„๋žตํ•˜๊ฒŒ ์งš๊ณ  ๋„˜์–ด๊ฐ”์—ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” ์˜ค๋ฒ„๋ผ์ด๋”ฉ๊ณผ ์˜ค๋ฒ„๋กœ๋”ฉ์ด ๊ตฌ์ฒด์ ์œผ๋กœ ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉ๋˜๋Š”์ง€. ๋˜, ์–ด๋–ค ์ฐจ์ด์ ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š”์ง€์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด์ž. ๋‹คํ˜•์„ฑ ๋‹คํ˜•์„ฑ์ด๋ž€, ํ•˜๋‚˜์˜ ๋ฉ”์†Œ๋“œ๋‚˜ ํด๋ž˜์Šค๊ฐ€ ์žˆ์„ ๋•Œ ์ด๊ฒƒ๋“ค์ด ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ๋™์ž‘ํ•˜๋Š” ๊ฒƒ์„ ๋งํ•œ๋‹ค. ์ž๋ฐ”์—์„œ๋Š” ์ฃผ๋กœ ์˜ค๋ฒ„๋กœ๋”ฉ(Overloading)๊ณผ ์˜ค๋ฒ„๋ผ์ด๋”ฉ(Overriding)์„ ํ†ตํ•ด์„œ ๋‹คํ˜•์„ฑ์„ ์ง€์›ํ•œ๋‹ค. ์˜ค๋ฒ„๋กœ๋”ฉ(Overloading) - ํ™•์žฅ ํ•˜๋‚˜์˜ ํด๋ž˜์Šค ๋‚ด๋ถ€์—์„œ ํ™•์žฅํ•˜๋Š” ๊ฐœ๋… ์˜ค๋ฒ„๋ผ์ด๋”ฉ(Overriding) - ์žฌ์ •์˜ ๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ์ƒ์†์„ ๋ฐ›์€ ์ž์‹ ํด๋ž˜..

Programming/Java 2023.07.09
728x90
๋ฐ˜์‘ํ˜•