Newsgroups: comp.lang.beta,comp.lang.eiffel,comp.object Path: news.daimi.aau.dk!news.uni-c.dk!sunic!trane.uninett.no!eunet.no!nuug!EU.net!sun4nl!news.nic.surfnet.nl!tudelft.nl!dutllu4!nash From: nash@dutllu4.gmd.de (Naresh Sharma) Subject: Re: On why BETA does not have multiple inheritance Message-ID: Followup-To: comp.lang.beta,comp.lang.eiffel,comp.object Lines: 73 Sender: news@news.tudelft.nl (UseNet News System) Nntp-Posting-Host: dutllu4.lr.tudelft.nl Reply-To: Naresh.Sharma@LR.TUDelft.NL Organization: Faculty of Aerospace Engineering, T U Delft X-Newsreader: TIN [version 1.2 PL0] References: <358nrv$bpf@engnews2.Eng.Sun.COM> <35jb33$3q1@engnews2.Eng.Sun.COM> <35rmil$le7@ipx3.cadis.de> Date: Fri, 23 Sep 1994 09:07:11 GMT Xref: news.daimi.aau.dk comp.lang.beta:103 comp.lang.eiffel:6238 comp.object:19538 Robert Graulich (graulich@cadis.de) wrote: : olm@Eng.Sun.COM (Ole Lehrmann Madsen) writes: : >derway@ndc.com (D. Erway) writes: : ... : >> Ole> As a final example, consider the following well-know MI case: : >> Ole> Window : >> Ole> / \ : >> Ole> WindowWitBorder WindowWithTitle : >> Ole> \ / : >> Ole> WindowWithTitleAndBorder : Hi! : Please excuse me intruding your discussion, but I want to point out : the following. : With inheritance you express the relationship "A is B" : (in C++ class A : public B {}). : But in this example you want to model WindowWithTitleAndBorder HAS : WindowWithBorder and WindowWithTitle or even better : WindowWithTitleAndBorder HAS Border and Title. : But you say that WindowWithTitleAndBorder IS WWB and WWT. : Thats not true. When a class wants to HAVE something, this should : be layered. : (in C++: : class WindowWithTitleAndBorder : { : Border b; : Title t; : };) : What do you think about this? I think using MI at the right point is : good, but this is the situation, which can nobody predict. : (Because in C++ you must say if a base class is virtual or not. : But a library designer cannot predict it all. So why using : MI where it is no needed???) Not so, composition and inheritance are orthogonal abstraction mechanisms, and one can model a MI concept using composition+inheritance, like that shown by you. The model may be practical for your specific app, but that's about it! It will definitely *not* be conceptually sound in the global sense. What OleLM is trying to point out is that it is not necessary *FOR MOST* programs to have true MI with all the hassles of conflict addressing, name resoultion, structure flattening etc.etal., for them to implement MI in beta. In C++ you *must* use composition+inheritance for simulating a concept that is actually MI, there is one difference that to have real MI in C++ will be near impossible (if not impossible). There is no mechanism that can allow you to inherit from part-objects once only the composition is available in C++ but that's not true in case of beta. This means (correct me if I'm wrong) that the abstraction of beta can simulate MI much better than that of C++. Naresh -- _______________________________________________________________________________ Naresh Sharma [N.Sharma@LR.TUDelft.NL] Herenpad 28 __|__ Faculty of Aerospace Engineering 2628 AG Delft \_______(_)_______/ T U Delft Optimists designed the aeroplane, ! ! ! Ph(Work) (+31)15-783992 pessimists designed the parachute! Ph(Home) (+31)15-569636 Plan:Design Airplanes on Linux the best OS on Earth! ------------------------------PGP-KEY-AVAILABLE--------------------------------