الواجهات
الواجهات
يُعرَّف نوع الواجهة بأنه مجموعة من تواقيع التوابع.
يمكن لقيمة من نوع واجهة أن تحتوي على أي قيمة تنفّذ تلك التوابع.
ملاحظة: يوجد خطأ في شيفرة المثال في السطر 22.
لا ينفّذ Vertex (النوع القيمي) الواجهة Abser لأن
التابع Abs معرّف فقط على *Vertex (النوع المؤشري).
النص الأصلي بالإنجليزية
Interfaces
An interface type is defined as a set of method signatures.
A value of interface type can hold any value that implements those methods.
Note: There is an error in the example code on line 22.
Vertex (the value type) doesn't implement Abser because
the Abs method is defined only on *Vertex (the pointer type).
هذا الدرس للقراءة فقط؛ جرّب المثال في الدرس التالي.