fixes
This commit is contained in:
parent
2b804eb3c6
commit
49aef00235
1 changed files with 3 additions and 3 deletions
|
@ -164,7 +164,7 @@ class CoffeeMachine {
|
||||||
}
|
}
|
||||||
|
|
||||||
*!*getWaterAmount()*/!* {
|
*!*getWaterAmount()*/!* {
|
||||||
return this.waterAmount;
|
return this._waterAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ class CoffeeMachine {
|
||||||
}
|
}
|
||||||
|
|
||||||
get waterAmount() {
|
get waterAmount() {
|
||||||
return this.waterAmount;
|
return this._waterAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ Unlike protected ones, private fields are enforced by the language itself. That'
|
||||||
But if we inherit from `CoffeeMachine`, then we'll have no direct access to `#waterAmount`. We'll need to rely on `waterAmount` getter/setter:
|
But if we inherit from `CoffeeMachine`, then we'll have no direct access to `#waterAmount`. We'll need to rely on `waterAmount` getter/setter:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
class CoffeeMachine extends CoffeeMachine() {
|
class MegaCoffeeMachine extends CoffeeMachine() {
|
||||||
method() {
|
method() {
|
||||||
*!*
|
*!*
|
||||||
alert( this.#waterAmount ); // Error: can only access from CoffeeMachine
|
alert( this.#waterAmount ); // Error: can only access from CoffeeMachine
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue