File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
1-js/09-classes/02-class-inheritance Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -619,7 +619,10 @@ rabbit.eat(); // Error calling super (because there's no [[HomeObject]])
619
619
- We must call parent constructor as ` super() ` in ` Child ` constructor before using ` this ` .
620
620
3 . When overriding another method:
621
621
- 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:
623
626
- Methods remember their class/object in the internal ` [[HomeObject]] ` property. That's how ` super ` resolves parent methods.
624
627
- So it's not safe to copy a method with ` super ` from one object to another.
625
628
You can’t perform that action at this time.
0 commit comments