مشكل التعامل مع Generic Interface
#1
السلام عليكم ورحمة الله تعالى وبركاته

عيدكم مبارك وكل عام وانتم بخير

قمت بعمل وحدة جديدة تحتوي على class الهدف منها هو عمل implementation للـ Generic interface IComparer , حيث هذه الأخيرة معرفة في وحدة Generics.Defaults كما يلي :

كود :
IComparer<T> = interface     function Compare(const Left, Right: T): Integer;   end;

وهذه الوحدة التي أنشائتها :

كود :
unit uMyComparer; interface uses Generics.Defaults; type   TPersonne = record     ID : word;     Nom : String[30];     Age : byte;   end;   TMyComparer<TPersonne> = class(TInterfacedObject, IComparer<TPersonne>)     public       function Compare(const Left, Right: TPersonne): Integer;   end; implementation { TMyComparer<TPersonne> } function TMyComparer<TPersonne>.Compare(const Left, Right: TPersonne): Integer; begin   Result := left.ID - Right.ID; end; end.

المشكلة : توجد في السطر 
كود :
Result := left.ID - Right.ID

ومضمونها : انه لم يتم التعرف على الحقل ID 

السؤال : ماسبب الخطأ, وماهي خطوات حله؟
الرد


الردود في هذا الموضوع
مشكل التعامل مع Generic Interface - بواسطة MasteranyOne - 01-08-2020, 06:29 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم