ENع
الدرس 09 · Objects

Inheritance and interfaces

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

A base class holds what related classes share; a derived class inherits it with a colon and overrides what must differ. An interface is a contract any class can sign. Follow one small program: Square and Rect inherit from the abstract class Shape, which implements IShape; the same line of code prints Square: 9 and then Rect: 10, because each call runs the override of the object's real type.

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

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