Name |
Object 对象 |
||||||
Examples |
// Declare and construct two objects (h1, h2) from the class HLine HLine h1 = new HLine(20, 2.0); HLine h2 = new HLine(50, 2.5);
void setup() { size(200, 200); frameRate(30); }
void draw() { background(204); h1.update(); h2.update(); }
class HLine { float ypos, speed; HLine (float y, float s) { ypos = y; speed = s; } void update() { ypos += speed; if (ypos > width) { ypos = 0; } line(0, ypos, width, ypos); } } |
||||||
Description 描述 |
Objects are instances of classes. A class is a grouping of related methods (functions) and fields (variables and constants). 对象是类的实例。类是相关方法 (函数) 和字段 (变量和常量) 的分组。 |
||||||
Syntax |
ClassName instanceName |
||||||
Parameters |
|
||||||
Related |
- 本文固定链接: http://iprocessing.cn/2017/07/19/object-对象/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表