From 1689fcecbc4a5589366a50ed40279020fa5eee48 Mon Sep 17 00:00:00 2001 From: Shubham Kumar Date: Wed, 27 Jan 2021 17:24:20 +0530 Subject: [PATCH 1/3] Corrected code for Inheritance which was not implementing inheritance using extends keyword --- .../examples/en/11_Objects/04_Inheritance.js | 23 +++++++++---------- .../examples/es/11_Objects/04_Inheritance.js | 23 +++++++++---------- .../examples/ko/11_Objects/04_Inheritance.js | 23 +++++++++---------- .../zh-Hans/11_Objects/04_Inheritance.js | 23 +++++++++---------- 4 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/data/examples/en/11_Objects/04_Inheritance.js b/src/data/examples/en/11_Objects/04_Inheritance.js index 32b6a630e3..088aeb0cb8 100644 --- a/src/data/examples/en/11_Objects/04_Inheritance.js +++ b/src/data/examples/en/11_Objects/04_Inheritance.js @@ -21,17 +21,23 @@ function draw() { spots.display(); } -class SpinArm { - constructor(x, y, s) { +class Spin { + constructor(x,y,s) { this.x = x; this.y = y; this.speed = s; this.angle = 0.0; } - + 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() { diff --git a/src/data/examples/es/11_Objects/04_Inheritance.js b/src/data/examples/es/11_Objects/04_Inheritance.js index d1b44272f3..070db34939 100644 --- a/src/data/examples/es/11_Objects/04_Inheritance.js +++ b/src/data/examples/es/11_Objects/04_Inheritance.js @@ -21,17 +21,23 @@ function draw() { spots.display(); } -class SpinArm { - constructor(x, y, s) { +class Spin { + constructor(x,y,s) { this.x = x; this.y = y; this.speed = s; this.angle = 0.0; } - + 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() { diff --git a/src/data/examples/ko/11_Objects/04_Inheritance.js b/src/data/examples/ko/11_Objects/04_Inheritance.js index 12b3737c05..b25d812abc 100644 --- a/src/data/examples/ko/11_Objects/04_Inheritance.js +++ b/src/data/examples/ko/11_Objects/04_Inheritance.js @@ -21,17 +21,23 @@ function draw() { spots.display(); } -class SpinArm { - constructor(x, y, s) { +class Spin { + constructor(x,y,s) { this.x = x; this.y = y; this.speed = s; this.angle = 0.0; } - + 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() { 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..87bca76d84 100644 --- a/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js +++ b/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js @@ -20,17 +20,23 @@ function draw() { spots.display(); } -class SpinArm { - constructor(x, y, s) { +class Spin { + constructor(x,y,s) { this.x = x; this.y = y; this.speed = s; this.angle = 0.0; } - + 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() { From 0288a7342f676651790f08fc0c67b058376e62f1 Mon Sep 17 00:00:00 2001 From: Shubham Kumar Date: Sun, 31 Jan 2021 00:03:14 +0530 Subject: [PATCH 2/3] Added space and removed extra whitespace at the end --- src/data/examples/en/11_Objects/04_Inheritance.js | 8 ++++---- src/data/examples/es/11_Objects/04_Inheritance.js | 8 ++++---- src/data/examples/ko/11_Objects/04_Inheritance.js | 8 ++++---- src/data/examples/zh-Hans/11_Objects/04_Inheritance.js | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/data/examples/en/11_Objects/04_Inheritance.js b/src/data/examples/en/11_Objects/04_Inheritance.js index 088aeb0cb8..85a27b4d23 100644 --- a/src/data/examples/en/11_Objects/04_Inheritance.js +++ b/src/data/examples/en/11_Objects/04_Inheritance.js @@ -22,7 +22,7 @@ function draw() { } class Spin { - constructor(x,y,s) { + constructor(x, y, s) { this.x = x; this.y = y; this.speed = s; @@ -36,7 +36,7 @@ class Spin { class SpinArm extends Spin { constructor(x, y, s) { - super(x,y,s) + super(x, y, s) } display() { @@ -53,7 +53,7 @@ class SpinArm extends Spin { class SpinSpots extends Spin { constructor(x, y, s, d) { - super(x,y,s) + super(x, y, s) this.dim = d; } @@ -67,4 +67,4 @@ class SpinSpots extends Spin { 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 070db34939..084e099e34 100644 --- a/src/data/examples/es/11_Objects/04_Inheritance.js +++ b/src/data/examples/es/11_Objects/04_Inheritance.js @@ -22,7 +22,7 @@ function draw() { } class Spin { - constructor(x,y,s) { + constructor(x, y, s) { this.x = x; this.y = y; this.speed = s; @@ -36,7 +36,7 @@ class Spin { class SpinArm extends Spin { constructor(x, y, s) { - super(x,y,s) + super(x, y, s) } display() { @@ -53,7 +53,7 @@ class SpinArm extends Spin { class SpinSpots extends Spin { constructor(x, y, s, d) { - super(x,y,s) + super(x, y, s) this.dim = d; } @@ -67,4 +67,4 @@ class SpinSpots extends Spin { 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 b25d812abc..436bd40c3c 100644 --- a/src/data/examples/ko/11_Objects/04_Inheritance.js +++ b/src/data/examples/ko/11_Objects/04_Inheritance.js @@ -22,7 +22,7 @@ function draw() { } class Spin { - constructor(x,y,s) { + constructor(x, y, s) { this.x = x; this.y = y; this.speed = s; @@ -36,7 +36,7 @@ class Spin { class SpinArm extends Spin { constructor(x, y, s) { - super(x,y,s) + super(x, y, s) } display() { @@ -53,7 +53,7 @@ class SpinArm extends Spin { class SpinSpots extends Spin { constructor(x, y, s, d) { - super(x,y,s) + super(x, y, s) this.dim = d; } @@ -67,4 +67,4 @@ class SpinSpots extends Spin { 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 87bca76d84..950c8bfa3d 100644 --- a/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js +++ b/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js @@ -21,7 +21,7 @@ function draw() { } class Spin { - constructor(x,y,s) { + constructor(x, y, s) { this.x = x; this.y = y; this.speed = s; @@ -35,7 +35,7 @@ class Spin { class SpinArm extends Spin { constructor(x, y, s) { - super(x,y,s) + super(x, y, s) } display() { @@ -52,7 +52,7 @@ class SpinArm extends Spin { class SpinSpots extends Spin { constructor(x, y, s, d) { - super(x,y,s) + super(x, y, s) this.dim = d; } @@ -66,4 +66,4 @@ class SpinSpots extends Spin { ellipse(this.dim/2, 0, this.dim, this.dim); pop(); } -} +} \ No newline at end of file From 52c6cf2261aa3c54af0e8c3397eb56652d3dd268 Mon Sep 17 00:00:00 2001 From: Shubham Kumar Date: Sun, 31 Jan 2021 17:49:41 +0530 Subject: [PATCH 3/3] Removed white extra white spaces --- src/data/examples/en/11_Objects/04_Inheritance.js | 2 +- src/data/examples/es/11_Objects/04_Inheritance.js | 2 +- src/data/examples/ko/11_Objects/04_Inheritance.js | 2 +- src/data/examples/zh-Hans/11_Objects/04_Inheritance.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data/examples/en/11_Objects/04_Inheritance.js b/src/data/examples/en/11_Objects/04_Inheritance.js index 85a27b4d23..9070daa336 100644 --- a/src/data/examples/en/11_Objects/04_Inheritance.js +++ b/src/data/examples/en/11_Objects/04_Inheritance.js @@ -28,7 +28,7 @@ class Spin { this.speed = s; this.angle = 0.0; } - + update() { this.angle += this.speed; } diff --git a/src/data/examples/es/11_Objects/04_Inheritance.js b/src/data/examples/es/11_Objects/04_Inheritance.js index 084e099e34..b1a0af4203 100644 --- a/src/data/examples/es/11_Objects/04_Inheritance.js +++ b/src/data/examples/es/11_Objects/04_Inheritance.js @@ -28,7 +28,7 @@ class Spin { this.speed = s; this.angle = 0.0; } - + update() { this.angle += this.speed; } diff --git a/src/data/examples/ko/11_Objects/04_Inheritance.js b/src/data/examples/ko/11_Objects/04_Inheritance.js index 436bd40c3c..ab5a51bafa 100644 --- a/src/data/examples/ko/11_Objects/04_Inheritance.js +++ b/src/data/examples/ko/11_Objects/04_Inheritance.js @@ -28,7 +28,7 @@ class Spin { this.speed = s; this.angle = 0.0; } - + update() { this.angle += this.speed; } 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 950c8bfa3d..2218f3c83f 100644 --- a/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js +++ b/src/data/examples/zh-Hans/11_Objects/04_Inheritance.js @@ -27,7 +27,7 @@ class Spin { this.speed = s; this.angle = 0.0; } - + update() { this.angle += this.speed; }