You can put a variable there, and because it's not encapsulated in curly braces, as we just discussed, that essentially means it's accessible everywhere in that file.
你可以加入一个变量,因为它不是封装在花括号里,就像我们刚才讨论的,本质的意思是它可以在文件的所有地方,都可以被访问到。
And the last piece I want you to see here, and then I'll let you go is, notice now how that encapsulation, that binding things together has really helped me.
我想要的那么干净,最后一点要给大家讲的是,也就是下课前讲的一点,就是请注意这里是怎么封装的,也就是把东西绑定在一起。
There's a whole bunch of stuff at the top which is wrapping in an ugly way 'cause I've made my font so big.
顶部有一大堆封装好的东西,看起来很丑,因为我们的字体设置的很大。
OK, so what have I done? I just added a little bit more now. I'm now running through a pair of loops. Again notice the encapsulation, that nice abstraction going on, which is what I want. Once I get to this stage though by the way, there might be more than one solution.
我现在运行了一对循环,再一次注意这个封装,抽象得很好,这就是我想要的结果,我按这种方式走到这一步的时候,可能会有多组答案。
And that's a wonderful thing to have because it gives you that modularity, that encapsulation that basically says, when I create a point, the only way I can get at the values, is by using one of the defined methods, in this case it could be Cartesian, Cartesian and get all the pieces of that.
这是很棒的一件事情,因为它让你有了,模块性以及封装性,这基本上也就是说,当我创建了一个点,我能够得到它的值的唯一的方式,就是用一个定义好的方法,在这个例子中也就是。
应用推荐