ANSWER TO EXERCISE 54 | |
Class Coin with name "coin" "coins//p", description "A round unstamped disc, presumably local currency.", list_together "coins", plural [; print (string) (self.&name)-->0; if (~~(listing_together ofclass Coin)) print " coins"; ], short_name [; if (listing_together ofclass Coin) { print (string) (self.&name)-->0; rtrue; } ], article [; if (listing_together ofclass Coin) print "one"; else print "a"; ]; Class Gold_coin class Coin with name "gold"; Class Silver_coin class Coin with name "silver"; Class Bronze_coin class Coin with name "bronze"; SilverCoin -> "silver coin"; ... and so on |