ENع
الدرس 17 · Classes

Inheritance and virtual functions

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

A derived class is built on a base class: a Dog is an Animal plus more. Follow one Dog object as main makes it and uses it through a pointer to Animal: watch the Animal part get built before the Dog part, a normal call go where the pointer's type says, a virtual call go where the object really is (through the hidden vptr and vtable), override catch a typo, and the destructors run Dog first, then Animal.

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

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