diff --git a/src/data/examples/en/11_Objects/04_Inheritance.js b/src/data/examples/en/11_Objects/04_Inheritance.js index 32b6a630e3..9070daa336 100644 --- a/src/data/examples/en/11_Objects/04_Inheritance.js +++ b/src/data/examples/en/11_Objects/04_Inheritance.js @@ -21,7 +21,7 @@ function draw() { spots.display(); } -class SpinArm { +class Spin { constructor(x, y, s) { this.x = x; this.y = y; @@ -32,6 +32,12 @@ class SpinArm { update() { this.angle += this.speed; } +} + +class SpinArm extends Spin { + constructor(x, y, s) { + super(x, y, s) + } display() { strokeWeight(1); @@ -45,17 +51,10 @@ class SpinArm { } } -class SpinSpots { +class SpinSpots extends Spin { constructor(x, y, s, d) { - this.x = x; - this.y = y; - this.speed = s; + super(x, y, s) this.dim = d; - this.angle = 0.0; - } - - update() { - this.angle += this.speed; } display() { @@ -68,4 +67,4 @@ class SpinSpots { ellipse(this.dim/2, 0, this.dim, this.dim); pop(); } -} +} \ No newline at end of file diff --git a/src/data/examples/es/11_Objects/04_Inheritance.js b/src/data/examples/es/11_Objects/04_Inheritance.js index d1b44272f3..b1a0af4203 100644 --- a/src/data/examples/es/11_Objects/04_Inheritance.js +++ b/src/data/examples/es/11_Objects/04_Inheritance.js @@ -21,7 +21,7 @@ function draw() { spots.display(); } -class SpinArm { +class Spin { constructor(x, y, s) { this.x = x; this.y = y; @@ -32,6 +32,12 @@ class SpinArm { update() { this.angle += this.speed; } +} + +class SpinArm extends Spin { + constructor(x, y, s) { + super(x, y, s) + } display() { strokeWeight(1); @@ -45,17 +51,10 @@ class SpinArm { } } -class SpinSpots { +class SpinSpots extends Spin { constructor(x, y, s, d) { - this.x = x; - this.y = y; - this.speed = s; + super(x, y, s) this.dim = d; - this.angle = 0.0; - } - - update() { - this.angle += this.speed; } display() { @@ -68,4 +67,4 @@ class SpinSpots { ellipse(this.dim/2, 0, this.dim, this.dim); pop(); } -} +} \ No newline at end of file diff --git a/src/data/examples/ko/11_Objects/04_Inheritance.js b/src/data/examples/ko/11_Objects/04_Inheritance.js index 12b3737c05..ab5a51bafa 100644 --- a/src/data/examples/ko/11_Objects/04_Inheritance.js +++ b/src/data/examples/ko/11_Objects/04_Inheritance.js @@ -21,7 +21,7 @@ function draw() { spots.display(); } -class SpinArm { +class Spin { constructor(x, y, s) { this.x = x; this.y = y; @@ -32,6 +32,12 @@ class SpinArm { update() { this.angle += this.speed; } +} + +class SpinArm extends Spin { + constructor(x, y, s) { + super(x, y, s) + } display() { strokeWeight(1); @@ -45,17 +51,10 @@ class SpinArm { } } -class SpinSpots { +class SpinSpots extends Spin { constructor(x, y, s, d) { - this.x = x; - this.y = y; - this.speed = s; + super(x, y, s) this.dim = d; - this.angle = 0.0; - } - - update() { - this.angle += this.speed; } display() { @@ -68,4 +67,4 @@ class SpinSpots { ellipse(this.dim/2, 0, this.dim, this.dim); pop(); } -} +} \ No newline at end of file diff --git a/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js b/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js index fd4681e71a..2218f3c83f 100644 --- a/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js +++ b/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js @@ -20,7 +20,7 @@ function draw() { spots.display(); } -class SpinArm { +class Spin { constructor(x, y, s) { this.x = x; this.y = y; @@ -31,6 +31,12 @@ class SpinArm { update() { this.angle += this.speed; } +} + +class SpinArm extends Spin { + constructor(x, y, s) { + super(x, y, s) + } display() { strokeWeight(1); @@ -44,17 +50,10 @@ class SpinArm { } } -class SpinSpots { +class SpinSpots extends Spin { constructor(x, y, s, d) { - this.x = x; - this.y = y; - this.speed = s; + super(x, y, s) this.dim = d; - this.angle = 0.0; - } - - update() { - this.angle += this.speed; } display() { @@ -67,4 +66,4 @@ class SpinSpots { ellipse(this.dim/2, 0, this.dim, this.dim); pop(); } -} +} \ No newline at end of file