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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a5d76152c5cb8790 X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: class-wide objects Date: 1998/12/11 Message-ID: #1/1 X-Deja-AN: 421320563 References: <366B1190.C8142307@magic.fr> <366EE6BA.7D586BDD@magic.fr> Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Newsgroups: comp.lang.ada Date: 1998-12-11T00:00:00+00:00 List-Id: Matthew Heaney writes: > Then just make it non-primitive: > > generic > ... > package Stacks is > > type Stack_Type is ... > ... > package Constructors is > > function Copy (Stack : Stack_Type) return Stack_Access; > > end; > ... > end Stacks; > > > Because Copy is non-primitive, it won't get inherited during derivation. > Another way to make an operation non-primitive is to use 'class: function Copy (Stack : Stack_Type'class) return Stack_Access; I've been flip-flopping about which way is "best". Using 'class sometimes implies re-dispatching in the body, but not always. If the non-primitive operations belong in a group (like Constructors), then the local package seems neat. But for other operations, a local package is just noise, and 'class seems preferable. -- Stephe