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
But most of the time `get.../set...` functions are preferred, like this:
157
+
اما اکثر اوقات تابعهای `get.../set...` ترجیح داده میشوند، مثلا اینگونه:
158
158
159
159
```js
160
160
class CoffeeMachine {
@@ -173,15 +173,15 @@ class CoffeeMachine {
173
173
new CoffeeMachine().setWaterAmount(100);
174
174
```
175
175
176
-
That looks a bit longer, but functions are more flexible. They can accept multiple arguments (even if we don't need them right now).
176
+
این کمی طولانیتر بنظر میرسد اما تابعها بیشتر منعطف هستند. آنها میتوانند چند آرگومان دریافت کنند (حتی اگر ما همین الان به آنها نیاز نداشته باشیم).
177
177
178
-
On the other hand, get/set syntax is shorter, so ultimately there's no strict rule, it's up to you to decide.
178
+
از سویی دیگر، سینتکس get/set` کوتاهتر است پس در نهایت هیچ قانونی وجود ندارد، تصمیم با شماست.
179
179
````
180
180
181
-
```smart header="Protected fields are inherited"
182
-
If we inherit `class MegaMachine extends CoffeeMachine`, then nothing prevents us from accessing `this._waterAmount` or `this._power` from the methods of the new class.
181
+
```smart header="فیلدهای محافظتشده به ارث برده میشوند"
182
+
اگر ما `class MegaMachine extends CoffeeMachine` را ارثبری کنیم، سپس چیزی جلوی ما را برای دسترسی به `this._waterAmount` یا `this._power` از متدهای کلاس جدید نمیگیرد.
183
183
184
-
So protected fields are naturally inheritable. Unlike private ones that we'll see below.
184
+
پس فیلدهای محافظتشده به طور طبیعی قابل ارثبری هستند. برخلاف فیلدهای خصوصی که پایین خواهیم دید.
0 commit comments