about chaper 11 operator overloading
Hello!
In the operator overloading > for the card library (page 309 and 310)
Below is a piece of this method that must be wrong
Here it will come if card1 is of the same suit as card2.
But here it check if card1 is of Rank.Ace and if true
it check if card2 is also Rank.Ace.
But hello you can't have two Ace of the same suit.This must be wrong?
if (isAceHigh)
{
if (card1.rank == Rank.Ace)
{
if (card2.rank == Rank.Ace)
return false;
else
return true;
}
else
{
if (card2.rank == Rank.Ace)
return false;
else
return (card1.rank > card2.rank);
}
}
|