Previous Topic Next topic Print topic


COBCH1623 Anonymous method or method group cannot be cast to type name.

An anonymous method or method group cannot be found with a valid signature for the delegate.

In the following example, the error is produced because none of the myType1::m methods match the signature specified by myDelegateID.

class-id myClass.Class1.      

method-id main static.
01 myDel type myDelegateID.
01 myType1 type Class2.

set myDel to method myType1::m   
end method.
end class.
      
delegate-id myDelegateID.
  procedure division using by value s as string.
end delegate.

class-id Class2.

method-id m.
 procedure division using by value s1 as string returning n1 as binary-long.
          set n1 to size of s1 + 3
end method.

method-id m.
 procedure division using by value s1 as string s2 as string returning n1 as binary-long.
end method.
end class.

See Delegates and Events for more information.

Previous Topic Next topic Print topic