June 2019
Beginner to intermediate
770 pages
19h 24m
English
Two classes are polymorphic when they share common attributes and methods. One common example of this is objects of the int and float classes. Both have __add__() methods to implement the + operator. Another example of this is that most collections offer a __len__() method to implement the len() function. The results are produced in different ways, depending on the implementation details.
Let's define Hand so that it will perform a meaningful mixed-class comparison among several subclasses of Hand. As with same-class comparisons, we have to determine precisely what we're going to compare. We'll look at the following three cases:
Read now
Unlock full access