Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!milano!cadillac!lynx!franke From: franke@lynx.cad.mcc.com (David Franke) Newsgroups: comp.object Subject: Re: Examples of Multiple Inheritance? Message-ID: <13688@cadillac.CAD.MCC.COM> Date: 5 Dec 90 15:22:29 GMT References: <60700005@inmet> Sender: news@cadillac.CAD.MCC.COM Reply-To: franke%cad@MCC.COM (David Franke) Organization: MCC CAD Program, Austin, TX Lines: 59 In article <60700005@inmet> stt@inmet.inmet.com writes: > >We are looking for a few good examples of multiple inheritance >in the programming language (especially C++) arena (as opposed to OODB, >OOD, OOA arenas) > ... >We are looking for an example of a C++ class (or Eiffel, Objective C, >etc.) which is a "true" sub-class of two (or more) parent classes; >that is, it bears the "is-a" relationship to multiple parents. I believe that I can provide such an example. I have been interested in imbedding rule inferencing in CAD tools, have developed an objected-oriented approach, and have implemented this approach in C++. (An article, "Embedding Rule Inferencing in Applications" will appear in Dec. 90 IEEE Expert). The basic idea is that an inference-object class is defined that a tool developer can include (derive from) when creating classes needed for the tool. While the tool views instances of the derived class for its purposes (e.g. schematic editing, timing analysis), the inference engine can view these same instances for its purpose. As you state, this derived class "is-a" tool object and "is-a" inference engine object. >Our hypothesis is that multiple inheritance can rarely be useful >unless planned for in advance, which seems to defeat the purpose. It is certainly true in this case that the multiple inheritance was planned in advance. The primary motivation has been the ability to integrate the inferencing capability into an existing tool (developed in C++) and tools under development with the least possible impact on tools defined classes. Multiple inheritance provides such a mechanism to accomplish this integration. >Multiple inheritance seems to add significant overhead to an OOPL even >when not being used in a system, so we are looking for convincing >examples that it's benefits outweigh the cost. IMO, multiple inheritance solves a significant problem in the application I have described. Specifically, the problem is that not all classes defined by a tool will be of interest in inferencing, and hence need not derive from the inference-object class. If the class hierarchy defined by the tool is very rich, one does not want to reference the inference-object class from one of the most general classes in the hierarchy (i.e. use only single inheritance), since it (the inference- object class) will probably participate in derived classes for which there is no interest with respect to inferencing. Multiple inheritance allows the tool developer to define an inferencing capability for only those objects of interest, avoiding overhead in those objects for which inferencing is not needed. >S. Tucker Taft >Intermetrics, Inc. >733 Concord Avenue >Cambridge, MA 02138 > >stt@inmet.inmet.com ...!uunet!inmet!stt David Franke, MCC CAD Program | ARPA: franke@mcc.com | Phone: [512] 338-3641 UUCP: {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!cadillac!franke Brought to you by Super Global Mega Corp .com