function Shape() {
|
}
|
|
Shape.prototype.getType = function() {
|
return "Shape";
|
}
|
|
function Rectangle(a, b) {
|
this.a = a;
|
this.b = b;
|
}
|
|
Rectangle.prototype = Object.create(Shape.prototype);
|
Rectangle.prototype.constructor = Rectangle;
|
|
const r = new Rectangle(2, 3);
|
|
console.log(r.getType());
|
|
Rectangle.prototype.getType = function() {
|
return "Rectangle";
|
}
|
|
console.log(r.getType());
|