Overload of compare function not working

 

Hello,

time ago I downloaded from MQL4 the attached sample and it was working fine.

The sample generates a list and sorts it using different criteria.

The sample overloads COMPARE function to generate  custom sorting.

Now the overload  is not more working and the sample uses the base class sort.

I put a PRINT ("SORT") statement into compare  function and I do not see the print in the experts tab after the SORT.


Can someone help me?

Thanks

Files:
ListSample.mq4  14 kb
 

If the code worked before and it is not working now, maybe the declaration of CObject::Compare() function was changed.

As a virtual function, you need to declare the CMyListElement::Compare() function exactly as the "CObject::Compare()" function.

In Line 50, change the code to:

virtual int       Compare(const CObject *object,const int mode=0)const;

 You'll also need to do the same change at the function's implementation.

I already tested the code on my computer, it is working fine now :) 

Reason: