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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b18ccf7d301fe37 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-22 07:24:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Invoking abstract subprograms in Ada95 Date: Mon, 22 Apr 2002 16:24:26 +0200 Message-ID: References: <2dbd76f3.0204220524.158132bb@posting.google.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1019485466 7238426 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:22914 Date: 2002-04-22T16:24:26+02:00 List-Id: On 22 Apr 2002 06:24:15 -0700, michael.jackson5@virgin.net (Mike) wrote: >"Grein, Christoph" wrote in message news:... >> The following compiles fine (with Rational Apex): >> >> >> package Abstract_Class_Wide is >> >> type T is abstract tagged null record; >> >> procedure P (X : T) is abstract; >> >> procedure C (X : T'Class); >> >> end Abstract_Class_Wide; >> >> package body Abstract_Class_Wide is >> >> procedure C (X : T'Class) is >> begin >> P (X); >> end C; >> >> end Abstract_Class_Wide; > >Hmm - the only differences I can see here are that my abstract method >also takes a classwide type, That's the point. It is not a method [in the meaning "overridable"], when the formal parameter is class wide. It could be a method only relatively to some specific formal parameter[s]. Class wide means "one for all derived types", so it cannot be overridden [at least till an introduction "class class wide types" (:-))] > and is implemented in a child package. >Here's the distilled problem: > >-- >package abstract_bit is > >type A is abstract tagged null record; > >procedure generalOperation( this : in out A'class ); >procedure specificOperation( this : in out A'class ) is abstract; If your intention is to override specificOperation for derived types, then it should be exactly as in Christoph's example: procedure specificOperation( this : in out A ) is abstract; >end abstract_bit; > >-- >package body abstract_bit is > >procedure generalOperation( this : in out A'class ) is >begin > specificOperation( this => this ); >end generalOperation; > >end abstract_bit; > >-- >package abstract_bit.concrete_bit is > >type C is new A with null record; > >procedure specificOperation( this : in out C ); > >end abstract_bit.concrete_bit; --- Regards, Dmitry Kazakov www.dmitry-kazakov.de