June 2019
Beginner to intermediate
770 pages
19h 24m
English
There are two considerations when defining comparison operators:
For a class with multiple attributes, we often have a profound ambiguity when looking at the comparison operators. It might not be perfectly clear which of the available attributes participate in the comparison.
Consider the humble playing card (again!). An expression, such as card1 == card2, is clearly intended to compare both rank and suit, right? Is that always true? After all, suit doesn't matter in games such as Blackjack.
If we want to decide whether a Hand object can be split, we must decide whether the ...
Read now
Unlock full access