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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6129ccd596d4814d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Nick Roberts Newsgroups: comp.lang.ada Subject: Re: Abstract Operations On A Tagged Record Date: Mon, 01 Nov 2004 18:09:56 +0000 Message-ID: <2uncfjF2c34toU1@uni-berlin.de> References: <2uhsidF2ahq9fU1@uni-berlin.de> <3qqhd.16031$ta5.3884@newsread3.news.atl.earthlink.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de zmFx+GAuvvCif5p/+rZc+Q/bIoNz9/tvt1BXLaNFU7coDp4Gk= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803 X-Accept-Language: en-us, en In-Reply-To: <3qqhd.16031$ta5.3884@newsread3.news.atl.earthlink.net> Xref: g2news1.google.com comp.lang.ada:5956 Date: 2004-11-01T18:09:56+00:00 List-Id: Marin David Condic wrote: > Thanks for the response. As both you and Dimitry observed, I rather > neglected to toss in the class parameter. I should have put in an > example with a base class operation that looked like: > > procedure Some_Op (The_Thing : in out Some_Tagged_Type'Class) > is abstract ; Although this declaration isn't actually illegal, it probably isn't what you intended, Marin. Since Some_Op is not a primitive operation of any named type, it cannot be inherited, and so cannot be overridden. It therefore does not ensure that an operation is implemented by any derived type. I'm fairly certain that you require something like: procedure Some_Op (The_Thing : in out Some_Tagged_Type; The_Params: in Some_Parameter_Type'Class) is abstract ; where Some_Parameter_Type is a tagged type (it could also be abstract) from which you derive types to specify particular variations and their specific parameter values, just as I (and Dmitry) illustrated. At the point where you /call/ Some_Op, you may well provide a class wide actual parameter, for The_Thing, for The_Params, or both, e.g.: declare This_Thing: constant Some_Tagged_Type'Class := From_Outer_Space; These_Params: constant Some_Parameter_Type'Class := What_To_Do; begin Some_Op( This_Thing, These_Params ); The call of Some_Op, in this example, will dispatch on the actual type of the class wide object This_Thing. Because it dispatches, it will call an concrete (non-abstract) overriding of Some_Op, for a concrete actual type (derived from Some_Tagged_Type). Does this make sense? -- Nick Roberts