Fix extending of class
This commit is contained in:
parent
4745f44bc1
commit
fd4d2f0c6f
1 changed files with 1 additions and 1 deletions
|
@ -248,7 +248,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 MegaCoffeeMachine 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