From 53fe5d24c78a79b12357356a98d3fcce4b5a7d0c Mon Sep 17 00:00:00 2001 From: Gleb Date: Mon, 10 Feb 2025 20:31:25 +0200 Subject: [PATCH] Update article.md Overriding class fields added to summary --- 1-js/09-classes/02-class-inheritance/article.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/1-js/09-classes/02-class-inheritance/article.md b/1-js/09-classes/02-class-inheritance/article.md index 464042d823..ee59b647bf 100644 --- a/1-js/09-classes/02-class-inheritance/article.md +++ b/1-js/09-classes/02-class-inheritance/article.md @@ -619,7 +619,10 @@ rabbit.eat(); // Error calling super (because there's no [[HomeObject]]) - We must call parent constructor as `super()` in `Child` constructor before using `this`. 3. When overriding another method: - We can use `super.method()` in a `Child` method to call `Parent` method. -4. Internals: +4. When overriding class fields, the class field is initialized: + - Before constructor for the base class (that doesn’t extend anything). + - Immediately after super() for the derived class. +5. Internals: - Methods remember their class/object in the internal `[[HomeObject]]` property. That's how `super` resolves parent methods. - So it's not safe to copy a method with `super` from one object to another.