From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,be30d7bb9651853b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-11 19:27:55 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!pipex!uunet!noc.near.net!inmet!dsd!stt From: stt@dsd.camb.inmet.com (Tucker Taft) Subject: Re: Ada 90 inheritance request? Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <3ca3vl$n14@lang8.cs.nyu.edu> Date: Mon, 12 Dec 1994 03:15:03 GMT Date: 1994-12-12T03:15:03+00:00 List-Id: In article <3ca3vl$n14@lang8.cs.nyu.edu>, Cyrille Comar wrote: > ... >PROBLEM: I have defined a hierarchy or tagged types and now I would like > specialize one of them to be controlled (i.e. finalizable) [Later you impose the additional requirement that the type be non-limited.] One cop-out solution is to make the root type controlled (even though OOP allows one to minimize the need to edit code when reusing it, it doesn't eliminate it altogether). Although this may seem be a bit of a cop-out, it may be that if one descendant of a type wants to "add" finalization, then other descendants would also benefit from it. Another approach is to simply make the new *components* controlled, rather than the type as a whole. In general, I would recommend that components clean up "themselves," rather than rely on a clean-up routine of an enclosing type. It seems to be simpler and more flexible. To give the best answer, it would help to have a better idea of what is the underlying problem you want to solve. In the abstract it is hard to make appropriate tradeoffs. For example, it might be a sign that you are abusing the "Is-A" relationship if a descendant needs to finalize the object as a whole (as opposed to just its new components) while its ancestor types do not. This might imply that inheritance is the wrong approach to begin with, and some other kind of type composition would fit the problem better. E.g., perhaps you should make the planned parent type into a component of your new type, rather than making the new type an extension of it. More details would help... >Cyrille Comar, E-mail: comar@cs.nyu.edu >Gnat Project US phone: (212) 998-3489 -Tucker Taft stt@inmet.com Intermetrics, Inc.