object

์•„์‹œ๋‹ค์‹œํ”ผ ํด๋ž˜์Šค์—๋Š” ์†์„ฑ attributes ์™€ ๋ฉ”์†Œ๋“œ methods ๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ๋“ค์„ ํด๋ž˜์Šค ๋ฉค๋ฒ„ ๋ผ๊ณ  ๋ถ€๋ฅด๋Š”๋ฐ์š”, ํด๋ž˜์Šค ๋ฉค๋ฒ„๋“ค์— ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ• ๊นŒ์š”? ๋ฐ”๋กœ ๊ฐ ๊ฐ์ฒด๋“ค์˜ ์ด๋ฆ„ ๋’ค์— dot operator(.) ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์€ํ–‰ ๊ณ„์ขŒ ๊ด€๋ฆฌ์šฉ Account ํด๋ž˜์Šค๋ฅผ ํ†ตํ•ด ricky_account๋ผ๋Š” ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ricky_account.balance, ricky_account.deposit(double)์œผ๋กœ ๊ฐ๊ฐ ์†์„ฑ๊ณผ ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜์˜€์Šต๋‹ˆ๋‹ค. Account ricky_account; ricky_account.balance; ricky_account.deposit(1000.00); ๊ทธ๋ ‡๋‹ค๋ฉด ๋™์ ์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ ๊ฐ์ฒด์— ๋Œ€ํ•ด์„œ๋Š” ์–ด๋–ป๊ฒŒ ํ• ๊นŒ์š”? ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ์Šต..
Chan Lee
'object' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก