Hello all

Hello all,
am pretty lost here.
could someone please show me how to implement an  Iequatable and Icomparable for various types in a record in delphi?
below is an example code i am trying to convert from csharp to delphi but i want to use a record instead of  class

public class test :
        IEquatable, IEquatable, IEquatable, IEquatable, IEquatable,
        IComparable, IComparable, IComparable, IComparable, IComparable, IComparable
    {


         public bool Equals(int n)
        {
            return this == n;
        }

        public bool Equals(uint n)
        {
            return this == n;

            
        }
}

Any Help will be appreciated.
 Thanks.

Comments

  1. I think Stefan's answer was a good one - have you investigated that?

    ReplyDelete
  2. Records cannot have interfaces, classes cannot have operator overloading. End of story. Pick one. If you go with the record then write equalitycomparer and comparer for your type that internally makes use of the operators.

    ReplyDelete
  3. @ all, thanks for replying, i guess i will go with writing my own equality comparer.
    Thanks once again.

    ReplyDelete

Post a Comment