我有一個類:繼承PShape
public class Shape extends PShape{
private String name;
private PApplet drawer;
public Shape(PApplet drawer, String name){
//constructor
this.drawer = drawer;
this.name = name;
}
}
如果我有
PShape s;
我會做
s = drawer.createShape();//return PShape
然而,PShape並沒有真正有一個構造函數,只是一個方法createShape返回一個PShape。
如果我想擴展PShape
,我會在Shape
的構造函數中放什麼?
this = drawer.createShape();
會這樣嗎?如果不是,我將如何初始化一個Shape
,延伸PShape
?在https://github.com/processing/processing/blob/master/core/src/processing/core/文件夾
PApplet.java
PGraphics.java
PShape.java
: