Implement IComparer - Incompatible data types in expression or assignement. (223)

Status
Not open for further replies.
S

Sebastien DErrico

Guest
I am trying to implement System.Collections.IComparer in Progress 4gl.

With the following code, I get the error: Incompatible data types in expression or assignement. (223)

CLASS Tools.Comparer.ItemByItemNo IMPLEMENTS System.Collections.IComparer:

METHOD PUBLIC INTEGER Compare(
INPUT o1 AS System.Object
,INPUT o2 AS System.Object):

/* declaration */
DEFINE VARIABLE oItem1 AS Entity.Item NO-UNDO.
DEFINE VARIABLE oItem2 AS Entity.Item NO-UNDO.

/* cast */
ASSIGN oItem1 = CAST(o1, "Entity.Item").
ASSIGN oItem2 = CAST(o2, "Entity.Item").

/* compare */
RETURN Tools.String:Compare(oItem1:ItemNo, oItem2:ItemNo).

END METHOD.

END CLASS.


Is it possible to cast a class from System.Object?

Thank you! Sebastien

Continue reading...
 
Status
Not open for further replies.
Top