function Childclass(){
this.printX = function(){
print(this.vector.y);
}
}
function Superclass(){
this.vector = createVector(1,2);
}
Childclass.prototype = new Superclass();
當運行printX()
我得到以下錯誤:如何在原型中使用createVector?
Uncaught ReferenceError: createVector is not defined at new Superclass
這可能在原型中使用createVector()
?
能否請您發表[MCVE]顯示正是你想做什麼?更好的是,你可以發佈JSFiddle或CodePen嗎? –