Sascha Schulz
2023-10-24 4d46431f0a310f3fe2d74f54dd2b67340c1e68a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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());