But there's actually hidden in there an important element, and that is, when I create an instance, I have to be able to get access to the things that characterize that instance.
也就是,当我创建了一个实例,我应该能够获得那些特性化,这个实例的东西,我的意思不是说它们是想法,或者情绪之类的。
So you can access the values of the specific instance.
现在,这还是有差别的,我为什么要这么做呢?
I think of data hiding as basically saying, one can only access instance values, or, we'll call them that, instance values through defined methods.
一个人仅仅可以访问实例变量,或者,我们可以这么来说,通过定义好的方法,来访问实例的变量。
And then it needs to have access to that, so it calls it, passing in self as the pointer to the instance.
把self作为指向这个实例的,指针传了进去,也就是,它的意思是现在。
应用推荐