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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no 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 06:48:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: Invoking abstract subprograms in Ada95 Date: Mon, 22 Apr 2002 15:44:31 +0200 (MET DST) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1019483283 36942 137.194.161.2 (22 Apr 2002 13:48:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 22 Apr 2002 13:48:03 +0000 (UTC) Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: 5FanI235R3Zb+FVgtv1Gog== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: "Grein, Christoph" List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:22909 Date: 2002-04-22T15:44:31+02:00 > "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, 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; Class-wide operations cannot be abstract, they also cannot be overrridden. OK, they can be abstract, this is why your code compiles, but abstractness here has a devastating meaning: There can never be such an operation! > end abstract_bit; > > -- > package body abstract_bit is > > procedure generalOperation( this : in out A'class ) is > begin > specificOperation( this => this ); You said it was abstract, so does not exist! Therefore you cannot call it here. > 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; > > > -- > package body abstract_bit.concrete_bit is > > procedure specificOperation( this : in out C ) is > begin > null; > end specificOperation; > > end abstract_bit.concrete_bit; > > -- main program > with abstract_bit.concrete_bit; > > procedure annoying is > > thingy : abstract_bit.concrete_bit.C; > > begin > abstract_bit.generalOperation( thingy ); > end annoying; > > > Mike > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada