Write some code to overload an operator.
class TempleCompare
{
public int templeCompareID;
public int templeValue;
public static bool operator == (TempleCompare x, TempleCompare y) {
return (x.templeValue == y.templeValue); }
public static bool operator != (TempleCompare x, TempleCompare y) {
return !(x == y); }
public override bool Equals(object o)
{
// check types match
if (o == null || GetType()!= o.GetType()) return false;
TempleCompare t = (templeCompare) o;
return (this.templeCompareID == t.templeCompareID) &&
(this.templeValue == t.templeValue);
}
public override int GetHashCode() { return templeCompareID; }
}