var sl = sl || {}
sl.Shape = function(){
this.x = 0;
this.y = 0;
};
sl.Shape.prototype.move = function(x,y){
this.x += x;
this.y += y;
};
sl.Rectangle = function(){
sl.Shape.call(this);
this.z = 0;
};
次の行では、Object Prototype undefinedがObjectまたはnullでなければなりません。私が見る限り、これはShapeが "名前空間"であるためです。javascriptの名前空間の内部でクラスを拡張するには?
sl.Rectangle.protoype = Object.create(sl.Shape.protoype);
sl.Rectangle.protoype.constructor = sl.Rectangle;
これを正しく行うにはどうすればよいですか?
おかげで、でも何で、それを見るために午前4時まで連れて行ってくれました書きました!! – Daniela