ºìÁªLinuxÃÅ»§
Linux°ïÖú

¸ø¶ÔÏóÒýÓñäÁ¿¸³Öµ

·¢²¼Ê±¼ä:2006-05-03 14:55:32À´Ô´:ºìÁª×÷Õß:reing
¶ÔÏó±äÁ¿µÄ¸³ÖµºÍÄãÖ±¾õÆÚÍûµÄ²»Í¬¡£ÀýÈ磬ÄãÈÏΪÏÂÃæµÄ³ÌÐò¶ÎÊÇ×öʲôÄØ£¿

Box b1 = new Box();
Box b2 = b1;

Äã¿ÉÄÜÈÏΪ£¬±äÁ¿b2±»¸³ÖµÎª±äÁ¿b1¶ÔÏóÒýÓõÄÒ»¸ö¿½±´¡£Ò²¾ÍÊÇ£¬Äã¿ÉÄÜÈÏΪb1ºÍb2ÒýÓõÄÊDz»Í¬µÄ¶ÔÏ󣬵«Êµ¼ÊÇé¿öÈ´Ïà·´£¬b1ºÍb2½«ÒýÓÃͬÑùµÄ¶ÔÏó¡£½«b1¸³Öµ¸øb2²¢Ã»ÓзÖÅäÈκÎÄÚ´æ»ò¶ÔÔ­¶ÔÏó×öÈκβ¿·ÖµÄ¿½±´¡£ÓÉÓÚËüÃÇÊÇͬһ¸ö¶ÔÏó£¬Òò´Ëͨ¹ý±äÁ¿b2¶Ô¶ÔÏóµÄ¸Ä±äÒ²½«Ó°Ïìb1Ëù¶ÔÓ¦µÄ¶ÔÏó¡£


¾¡¹Üb1ºÍb2¶¼ÒýÓÃͬһ¸ö¶ÔÏ󣬵«ÊÇËûÃÇÖ®¼äûÓÐÈκÎÆäËûµÄ¹Øϵ¡£ÀýÈ磬½ÓÏÂÀ´¶Ôb1µÄ¸³Öµ½ö½öʹb1ÍÑÀ루unhook £©³õʼ¶ÔÏ󣬶øûÓÐÓ°Ïì¶ÔÏó»òÓ°Ïìb2¡£

Box b1 = new Box();
Box b2 = b1;
// ...
b1 = null;

ÕâÀb1±»ÉèÖÃΪ¿Õ£¬µ«ÊÇb2ÈÔȻָÏòÔ­À´µÄ¶ÔÏó¡£

×¢Ò⣺µ±Ä㽫һ¸ö¶ÔÏóÒýÓø³Öµ¸øÁíÒ»¸ö¶ÔÏóÒýÓÃʱ£¬Ä㲢ûÓд´½¨¸Ã¶ÔÏóµÄÒ»¸ö¿½±´£¬¶øÊǽö½ö¶ÔÒýÓõÄÒ»¸ö¿½±´¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ