ENع
الدرس 17 · Objects

Classes

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

A class is a blueprint for objects that carry their own data. Step through counter.py: class Counter: builds one class object holding two methods; calling Counter(5) makes a new object and __init__ fills in its count; c.add(2) finds add on the class and changes that one object from 5 to 7; a second object keeps its own count. Finish with the mistake every newcomer makes once: forgetting self.

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

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