Skip to content

Commit 53fe5d2

Browse files
Update article.md
Overriding class fields added to summary
1 parent 6236eb8 commit 53fe5d2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

1-js/09-classes/02-class-inheritance/article.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,10 @@ rabbit.eat(); // Error calling super (because there's no [[HomeObject]])
619619
- We must call parent constructor as `super()` in `Child` constructor before using `this`.
620620
3. When overriding another method:
621621
- We can use `super.method()` in a `Child` method to call `Parent` method.
622-
4. Internals:
622+
4. When overriding class fields, the class field is initialized:
623+
- Before constructor for the base class (that doesn’t extend anything).
624+
- Immediately after super() for the derived class.
625+
5. Internals:
623626
- Methods remember their class/object in the internal `[[HomeObject]]` property. That's how `super` resolves parent methods.
624627
- So it's not safe to copy a method with `super` from one object to another.
625628

0 commit comments

Comments
 (0)