private 之新见

原来只要是同一个类的instance,那么private变量是可以随便访问的!

长见识了,以前还以为private就是绝对的private了!
这样设计的原因应该就是方便equals()这样的方法吧,不然写equals就难了,Hoho!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s