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,cf581b184a645a4c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-22 11:59:43 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!skynet.be!dispose.news.demon.net!news.demon.co.uk!demon!pogner.demon.co.uk!zap!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Dispatching and Child Packages Date: 21 Mar 2001 06:53:24 +0000 Organization: CodeFella Message-ID: References: <998rhs$fr4$1@sloth.swcp.com> NNTP-Posting-Host: localhost X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 X-Trace: news.demon.co.uk 985291010 nnrp-10:9750 NO-IDENT pogner.demon.co.uk:158.152.70.98 X-Complaints-To: abuse@demon.net NNTP-Posting-Date: 21 Mar 2001 06:53:27 GMT X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: supernews.google.com comp.lang.ada:6003 Date: 2001-03-21T06:53:27+00:00 List-Id: "Klatt, Nathan" writes: > Is it possible to dispatch from within a child package? The below code does > not work. If I collapse the child packages into their respective parents, > it dispatches as expected. (Ndk is an empty package.) So why didn't you include it :-) > ---------------------------------------------------------------------------- > package Ndk.Base is > > type Base is abstract tagged null record; > > end Ndk.Base; > ---------------------------------------------------------------------------- > package Ndk.Base.Child is > > procedure Do_Something (This : Base'Class); > procedure Real_Do_Something (This : Base) is abstract; > > end Ndk.Base.Child; > ---------------------------------------------------------------------------- > package body Ndk.Base.Child is > > procedure Do_Something (This : Base'Class) is > begin > Real_Do_Something (This); > end Do_Something; GNAT says: ndk-base-child.adb:6:09: cannot call abstract subprogram "Real_Do_Something" ndk-base-child.adb:6:28: class-wide argument not allowed here ndk-base-child.adb:6:28: "Real_Do_Something" is not a primitive operation of "Base" and the last remark is your problem. You need to declare Real_Do_Something in Ndk.Base. > package body Ndk.Sub.Child is > > procedure Real_Do_Something (This : Sub) is > begin > Ada.Text_Io.Put_Line ("Sub doing something..."); > end Real_To_String; ^^^^^^^^^ ahem! I don't think you compiled this before posting! > end Ndk.Sub.Child;