Skip to content

Commit 49aef00

Browse files
committed
fixes
1 parent 2b804eb commit 49aef00

File tree

1 file changed

+3
-3
lines changed
  • 1-js/09-classes/04-private-protected-properties-methods

1 file changed

+3
-3
lines changed

1-js/09-classes/04-private-protected-properties-methods/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class CoffeeMachine {
164164
}
165165
166166
*!*getWaterAmount()*/!* {
167-
return this.waterAmount;
167+
return this._waterAmount;
168168
}
169169
}
170170
@@ -215,7 +215,7 @@ class CoffeeMachine {
215215
}
216216

217217
get waterAmount() {
218-
return this.waterAmount;
218+
return this._waterAmount;
219219
}
220220

221221
}
@@ -262,7 +262,7 @@ Unlike protected ones, private fields are enforced by the language itself. That'
262262
But if we inherit from `CoffeeMachine`, then we'll have no direct access to `#waterAmount`. We'll need to rely on `waterAmount` getter/setter:
263263

264264
```js
265-
class CoffeeMachine extends CoffeeMachine() {
265+
class MegaCoffeeMachine extends CoffeeMachine() {
266266
method() {
267267
*!*
268268
alert( this.#waterAmount ); // Error: can only access from CoffeeMachine

0 commit comments

Comments
 (0)