Path: utzoo!attcan!uunet!odi!valens!dlw From: dlw@valens.odi.com (Dan Weinreb) Newsgroups: comp.lang.c++ Subject: Re: Use of inheritance for classification? Message-ID: <329@odi.ODI.COM> Date: 16 May 89 19:06:40 GMT References: <30582@apple.Apple.COM> <10248@riks.csl.sony.JUNET> Sender: news@odi.com Followup-To: comp.lang.c++ Lines: 24 In-reply-to: riks@csl.sony.JUNET's message of 15 May 89 01:45:43 GMT In article <10248@riks.csl.sony.JUNET> riks@csl.sony.JUNET (Rik Smoody) writes: In article <30582@apple.Apple.COM> kmcentee@Apple.COM (Kevin McEntee) writes: >should take place only in the context of the is-a relationship. > > e.g. Every dog is a mammal. But not all dogs are frisbeeCatchers. Do I need a special sub-class? In just about all of the popular object-oriented languages, an object is a direct member of exactly one class. So if you need special behavior for frisbee_catchers, then yes, you really do need a special class. Of course, there's no hope here without multiple inheritance, since ability to catch frisbees is orthagonal to biological order. The graph would look like this: mammal frisbee-catcher | | dog | | | \ / frisb-o-pup This is perfectly consistent with the original claim. A frisb-o-pup is a dog, a dog is a mammal, and a frisb-o-pup is a frisbee-catcher.