Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!zaphod.mps.ohio-state.edu!sunybcs!boulder!gore!jacob From: jacob@gore.com (Jacob Gore) Newsgroups: comp.object Subject: Re: inheritance and `type loss' Message-ID: <1130012@gore.com> Date: 11 Jul 90 03:38:01 GMT References: Reply-To: jacob@gore.com (Jacob Gore) Organization: Gore Enterprises Lines: 24 / comp.object / sra@ecs.soton.ac.uk (Stephen Adams) / Jul 10, 1990 / The key is that roman is a subclass of integer, and not vice versa. >(a) what should (V+V).image yield? "10" or "X"? "X", because a roman + a roman -> a roman > (V+1).image "6" or "VI"? "VI", because a roman + an integer -> a roman Why? A roman is an integer, so any place an integer can be used, a roman can be used just as well. Thus, "a roman + an integer" automatically gets the type of "a roman + a roman". > (1+V).image "6" or "VI" or error (in +)? "6", according to your definition of +. Not an error because V is a roman and hence an integer, and + is defined for two integers. Jacob -- Jacob Gore Jacob@Gore.Com boulder!gore!jacob