This

this ํฌ์ธํ„ฐ๋Š” ๊ฐ์ฒด์˜ ์ฃผ์†Œ๊ฐ’์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— *this ๋กœ ์ ‘๊ทผํ•˜๋ฉด ํ•ด๋‹น ๊ฐ์ฒด์˜ ์ฃผ์†Œ ๊ฐ’์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ์ด๋Š” ํด๋ž˜์Šค ๋ฒ”์œ„ ๋‚ด์—์„œ๋งŒ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. (ํŒŒ์ด์ฌ์„ ๊ณต๋ถ€ํ•ด๋ณด์…จ๋‹ค๋ฉด self ํ‚ค์›Œ๋“œ๋ฅผ ์ƒ๊ฐํ•˜์‹œ๋ฉด ์ดํ•ด๊ฐ€ ๋น ๋ฅผ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.) ์˜ˆ์‹œ๋ฅผ ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. void Account::set_balance(double balance){ this->balance = balance; } ์ž…๋ ฅ ์ธ์ž๋ฅผ balance_input ์™€ ๊ฐ™์ด ์„ค์ •ํ•˜๊ณ  balance = balance_input ์œผ๋กœ ํ•ด๋„ ๋˜์ง€๋งŒ, ์œ„์™€๊ฐ™์ด ๊ฐ์ฒด ์Šค์Šค๋กœ์˜ balance๋ฅผ this๋กœ ํ‘œ๊ธฐํ•˜์—ฌ ๊ตฌ๋ถ„ํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.
Chan Lee
'This' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก