File tree 1 file changed +3
-3
lines changed
1-js/09-classes/02-class-inheritance
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -323,7 +323,7 @@ There's no own constructor in `Rabbit`, so `Animal` constructor is called.
323
323
324
324
What's interesting is that in both cases: ` new Animal() ` and ` new Rabbit() ` , the ` alert ` in the line ` (*) ` shows ` animal ` .
325
325
326
- ** In other words, parent constructor always uses its own field value, not the overridden one.**
326
+ ** In other words, the parent constructor always uses its own field value, not the overridden one.**
327
327
328
328
What's odd about it?
329
329
@@ -360,9 +360,9 @@ And that's what we naturally expect. When the parent constructor is called in th
360
360
361
361
...But for class fields it's not so. As said, the parent constructor always uses the parent field.
362
362
363
- Why is there the difference?
363
+ Why is there a difference?
364
364
365
- Well, the reason is in the field initialization order. The class field is initialized:
365
+ Well, the reason is the field initialization order. The class field is initialized:
366
366
- Before constructor for the base class (that doesn't extend anything),
367
367
- Immediately after ` super() ` for the derived class.
368
368
You can’t perform that action at this time.
0 commit comments