You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/09-classes/02-class-inheritance/article.md
+4-19Lines changed: 4 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -232,13 +232,9 @@ let rabbit = new Rabbit("White Rabbit", 10); // Error: this is not defined.
232
232
233
233
عفوًا! لدينا خطأ. الآن لا يمكننا إنشاء الأرانب. ماذا حصل؟
234
234
235
-
<<<<<<< HEAD
236
-
الإجابة المختصرة هي: يجب على منشئو الفصول الموروثة استدعاء `super (...)` و (!) قبل ذلك باستخدام `this`.
237
-
=======
238
-
The short answer is:
235
+
الاجابة السريعة:
239
236
240
-
-**Constructors in inheriting classes must call `super(...)`, and (!) do it before using `this`.**
241
-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
237
+
-**الإجابة المختصرة هي: يجب على منشئو الفصول الموروثة استدعاء `super (...)` و (!) قبل ذلك باستخدام `this`.**
242
238
243
239
...لكن لماذا؟ ماذا يجري هنا؟ في الواقع ، يبدو الشرط غريبًا.
244
240
@@ -251,11 +247,7 @@ The short answer is:
251
247
- عندما يتم تنفيذ وظيفة عادية باستخدام `new` ، فإنها تنشئ كائنًا فارغًا وتعينه بـ` this`.
252
248
- ولكن عندما يعمل منشئ مشتق ، فإنه لا يفعل ذلك. وتتوقع من المُنشئ الأصلي أن يقوم بهذه المهمة.
253
249
254
-
<<<<<<< HEAD
255
250
لذا يجب على المُنشئ المشتق استدعاء `super` من أجل تنفيذ مُنشئه الأصلي (غير المُشتق) ، وإلا فلن يتم إنشاء كائن` this`. وسنحصل على خطأ.
256
-
=======
257
-
So a derived constructor must call `super` in order to execute its parent (base) constructor, otherwise the object for `this` won't be created. And we'll get an error.
258
-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
259
251
260
252
لكي يعمل مُنشئ "الأرنب" ، يجب الاتصال بـ "super ()` قبل استخدام `this` ، كما يلي:
0 commit comments