using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;

namespace CompareThem
{
  class test
  {
    int a;
    internal test(int a)
    {
      this.a = a;
    }
    static public bool operator <=(test t1, test t2)
    {
      return t1.a <= t2.a;
    }
    static public bool operator >=(test t1, test t2)
    {
      return t1.a >= t2.a;
    }
    static public bool operator <(test t1, test t2)
    {
      return t1.a < t2.a;
    }
    static public bool operator >(test t1, test t2)
    {
      return t1.a > t2.a;
    }
    static public bool operator ==(test t1, test t2)
    {
      return t1.a == t2.a;
    }
    static public bool operator !=(test t1, test t2)
    {
      return t1.a == t2.a;
    }

  }
  class test2 : IComparable
  {
    int a;
    public test2(int a)
    {
      this.a = a;
    }
    public override bool Equals(object obj)
    {
      return ((IComparable)(this)).CompareTo(obj) == 0;
    }
    public override int GetHashCode()
    {
      return a / 3;
    }
    #region IComparable Members

    int IComparable.CompareTo(object obj)
    {
      if (obj is test2)
      {
        int a2 = ((test2)obj).a;
        if (a2 == a) return 0;
        if (a2 > a) return -1;
        return 1;
      }
      return 0;
    }

    #endregion
  }
  class Program
  {
    static void Main(string[] args)
    {
      test t1 = new test(1);
      test t2 = new test(2);
      Console.WriteLine(t1 <= t2);
      test2 a2 = new test2(1);
      test2 a3 = new test2(1);
      Console.WriteLine(a2 == a3);
      Console.WriteLine(a2.Equals(a3));
      Console.ReadLine();

    }
  }
}
