ENع
الدرس 16 · Classes

Operator overloading

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

In C++ an operator like + or == on your own class is a function call in disguise: the compiler turns a + b into operator+(a, b). Build a small Vec2 type with four operators, watch the values travel into each function and the result travel out, and learn when an operator should be a member, when it should be a free function, and which rules you cannot break.

12 دقيقة8 خطوات5 أسئلةIntermediate
شكل 16 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.