Path: utzoo!utgpu!watmath!watdragon!akwright From: akwright@watdragon.waterloo.edu (Andrew K. Wright) Newsgroups: comp.lang.c++ Subject: Re: OOP languages and software reuse Message-ID: <10257@watdragon.waterloo.edu> Date: 6 Dec 88 13:38:35 GMT References: <1250001@hpcllca.HP.COM> <612@cadillac.CAD.MCC.COM> <10121@watdragon.waterloo.edu> <1319@cod.NOSC.MIL> Reply-To: akwright@watdragon.waterloo.edu (Andrew K. Wright) Organization: U. of Waterloo, Ontario Lines: 21 In article <1319@cod.NOSC.MIL> owen@cod.nosc.mil.UUCP (Wallace E. Owen) writes: >In article <10121@watdragon.waterloo.edu> akwright@watdragon.waterloo.edu (Andrew K. Wright) writes: >>ie. I have a pre-existing class STRING (built by someone else), >>which I am not allowed to modify. Then I cannot sort it, unless >>the designer anticipated my need and caused STRING to inherit from >>SORTABLE. >This problem 'goes away' with multiple inheritance. Derive a class >SORTABLE_STRING from SORTABLE and STRING. This problem does *not* go away with multiple inheritance. The solution you propose is not acceptable because it requires me to modify existing code to use SORTABLE_STRING rather than STRING. Someone else has written a procedure which returns arrays of STRINGs (perhaps it is in a library). It is inviolate, you cannot touch it (perhaps you only have it in binary form, because you bought it from a software supplier). Single or multiple inheritance, you have no way of sorting this array. Andrew K. Wright akwright@watmath.waterloo.edu CS Dept., University of Waterloo, Ont., Canada.