For example, every value in Scala is an object, this includes basic data types (i.e. booleans, Numbers) as well as functions.
例如,Scala中的每个值都是一个对象,包括基本数据类型(即布尔值、数字等)在内,连函数也是对象。
I can now fill the new empty class with attributes such as string and number types (representing the elements of the character), as well as functions common to this class.
我现在能向这新的空类填充属性,诸如字符串和数字类型(代表了角色的成分),以及这个类中常用的函数。
At this point you can take a look at the sample code which includes the initialization I described earlier, as well as functions to plot single pixels, draw filled rectangles, and render text.
现在我们可以开始来查看样例代码了,它包含了前面介绍的初始化工作,以及处理单个像素、填充矩形和渲染文本的函数。
In particular functions that operate on the data, perhaps on other data as well. The key idea here is to bind together the data and the functions that operate on that data as a single thing.
特别是处理数据的函数,也可能处理其他数据,这里的关键思想就是,将函数和操作数据的函数。
应用推荐