Merge pull request #2770 from itaileshem/master

Fix grammar
This commit is contained in:
Ilya Kantor 2021-12-12 22:45:01 +03:00 committed by GitHub
commit 2d80f86a78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -323,7 +323,7 @@ There's no own constructor in `Rabbit`, so `Animal` constructor is called.
What's interesting is that in both cases: `new Animal()` and `new Rabbit()`, the `alert` in the line `(*)` shows `animal`.
**In other words, parent constructor always uses its own field value, not the overridden one.**
**In other words, the parent constructor always uses its own field value, not the overridden one.**
What's odd about it?
@ -360,9 +360,9 @@ And that's what we naturally expect. When the parent constructor is called in th
...But for class fields it's not so. As said, the parent constructor always uses the parent field.
Why is there the difference?
Why is there a difference?
Well, the reason is in the field initialization order. The class field is initialized:
Well, the reason is the field initialization order. The class field is initialized:
- Before constructor for the base class (that doesn't extend anything),
- Immediately after `super()` for the derived class.