October 2021
Intermediate to advanced
500 pages
16h 23m
English
If you do not specify a class to extend from, your class implicitly descends from a common superclass called Any. This means that every type in the language eventually extends from Any. In the case of your TownSquare class, the class hierarchy looks like Figure 15.2:
Figure 15.2 TownSquare type hierarchy
You can also use Any to define functions that accept any type of argument. Suppose that in NyetHack there are two things that can be a source of blessings: a blessed player or the room called The Fount of Blessings. A printIsSourceOfBlessings function, which checks and prints whether an object ...
Read now
Unlock full access