fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Operator overloading

Operator overloading 10 months 1 week ago #5740

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1545
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
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

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

Operator overloading 10 months 1 week ago #5741

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1545
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
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

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

Operator overloading 10 months 1 week ago #5742

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1545
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
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

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

  • Page:
  • 1