fbpx

Operator overloading

  • Wolfgang Riedmann
  • Wolfgang Riedmann's Avatar Topic Author
  • Offline
More
5 months 1 week ago #1 by Wolfgang Riedmann
Operator overloading was created by Wolfgang Riedmann
Hello,

is it possible to overload operators? Somewhere in the help it is mentioned, but I was not able to do it.
static method operator == ( self oMaster as efCrmTab, oItem as efCrmTab ) as logic

Thank you very much!

Wolfgang

Please Log in or Create an account to join the conversation.

  • Wolfgang Riedmann
  • Wolfgang Riedmann's Avatar Topic Author
  • Offline
More
5 months 1 week ago #2 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic Operator overloading
Hello,

I have found my error: the word "method" has to be removed:
static operator == ( self oMaster as efCrmTab, oItem as efCrmTab ) as logic

Wolfgang

Please Log in or Create an account to join the conversation.

  • Wolfgang Riedmann
  • Wolfgang Riedmann's Avatar Topic Author
  • Offline
More
5 months 1 week ago #3 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic Operator overloading
Hello,

to complete the issue for others:

If you implement the == operator, you have also to implement the != operator and the Equals() and GetHashCode() methods:
static operator == ( self oMaster as efCrmTab, oItem as efCrmTab ) as logic 

static operator != ( self oMaster as efCrmTab, oItem as efCrmTab ) as logic 

public method Equals( oItem as object ) as logic 

method GetHashCode() as int

Wolfgang

Please Log in or Create an account to join the conversation.