Unusual compiler error - Equals(object obj)
Error 1 'TexasHoldemCalculator.Card' does not contain a definition for 'equals' and no extension method 'equals' accepting a first argument of type 'TexasHoldemCalculator.Card' could be found (are you missing a using directive or an assembly reference?) C:\Users\Grorange\Documents\Visual Studio Codename Orcas\Projects\TexasHoldemCalculator\TexasHoldemCalculator\Hand.cs 188 16 TexasHoldemCalculator
I have these two functions:
public override boolEquals(objectobj)
{
return base.Equals(obj);
}public boolEquals(CardOther)
{
if(this== Other)
return true;
return false;
}
Anyone have any ideas? I'm having a hard time deciphering what that is trying to get me to do.
Well then, before getting there, I tried to implement the == and != operator overloads, and it gave me this:
Warning 2 'Namespace.Card' defines operator == or operator != but does not override Object.Equals(object o) C:\Users\Grorange\Documents\Visual Studio Codename Orcas\Projects\TexasHoldemCalculator\TexasHoldemCalculator\Hand.cs 8 15 TexasHoldemCalculator
How case sensitive is this when you can use Object and object? Or is there a typo?
And, I wasn't using the equals function, I was using Equals... I fixed it by including another function Equals(Card Other). I was getting trouble at first because I was trying to overload the new function, when I shouldn't have. I feel so stupid sometimes, lol.
> How case sensitive is this when you can use Object and object? Or is there a typo?
'object' is an alias for 'System.Object' and 'string' - for 'System.String'. But this not a common rule.
For instance, 'float' is an alias for 'System.Single', and 'bool' - for 'System.Boolean'.