๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿš— Major Study (Bachelor)/๐ŸŸ  JAVA Programming

JAVA ํ”„๋กœ๊ทธ๋ž˜๋ฐ 6.5

by UKHYUN22 2021. 10. 28.
728x90

6.5 Information hiding revisited

 

Information hiding์€ Instance ๋ณ€์ˆ˜๋Š” private๋กœ ํ•˜๊ณ 

์ด๋ฅผ ์ฝ๊ณ  ์“ธ ๋•Œ public ๋ฉ”์†Œ๋“œ๋ฅผ ๋งŒ๋“ค์–ด์„œ ์ ‘๊ทผํ•˜์ž๊ณ  ์žฌ์ •์˜ ํ–ˆ์—ˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ๊ทธ๋Œ€๋กœ ํ–ˆ๋Š”๋ฐ๋„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋”๋ผ!!!

Insecure ํ•œ ์‚ฌ๋ก€๊ฐ€ ์–ด๋–ค ๊ฒฝ์šฐ์ธ์ง€ ์‚ดํŽด๋ณด์ž๊ณ  ํ•˜์…จ๋‹ค.

 

Instance variable์˜ Type์ด ํด๋ž˜์Šค ์ผ ๋•Œ ์ฃผ์˜ํ•  ํ•„์š”๊ฐ€ ์žˆ๋‹ค.

 

private๋กœ ์„ ์–ธ์„ ํ–ˆ๋Š”๋ฐ Hacking ๋‹นํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค. 

์–ด๋–ป๊ฒŒ ๊ฐ€๋Šฅํ•œ ๊ฒƒ์ผ๊นŒ??

 

 

 

Object๋ฅผ ํ•ฉ๋ฒ•์ ์œผ๋กœ public ๋งค์†Œ๋“œ๋ฅผ ์ด์šฉํ•ด์„œ ๋„˜๊ฒจ์ฃผ๊ธฐ๋Š” ํ–ˆ์ง€๋งŒ

Object์˜ ์ฃผ์†Œ๊ฐ€ ๋„˜์–ด๊ฐ”๋‹ค๋Š” ๊ฒƒ์ด ๋ฌธ์ œ๊ฐ€ ๋œ๋‹ค.

 

 

Primitive type, cloning

 

Object์˜ ์ฃผ์†Œ๋ฅผ ๋„˜๊ธด ๊ฒƒ์ด ๋ฌธ์ œ๊ฐ€ ๋œ๋‹ค.

primitive ํƒ€์ž…์œผ๋กœ ๊ฐ’์„ ๋„˜๊ธฐ๋“ ๊ฐ€ ์›๋ณต์€ ๋ณต์ œํ•œ ๊ฒƒ์œผ๋กœ ๋„˜๊ธฐ๋ฉด ํ•ด๊ฒฐ๋  ๊ฒƒ์ด๋‹ค.