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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,910a48a538936849 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.buerger.net!open-news-network.org!news.teledata-fn.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: how to import a package From: Georg Bauhaus In-Reply-To: <1165893584.829025.235440@l12g2000cwl.googlegroups.com> References: <1165371252.358817.57840@80g2000cwy.googlegroups.com> <4577dc92$1_1@glkas0286.greenlnk.net> <7ft8le.vk1.ln@hunter.axlog.fr> <1165817760.736164.218530@73g2000cwn.googlegroups.com> <1165819804.449958.305980@73g2000cwn.googlegroups.com> <1165830005.15844.5.camel@localhost> <1165846777.475130.199390@f1g2000cwa.googlegroups.com> <1165893584.829025.235440@l12g2000cwl.googlegroups.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-ID: <1165920993.21859.15.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Date: Tue, 12 Dec 2006 11:56:34 +0100 NNTP-Posting-Date: 12 Dec 2006 11:55:44 CET NNTP-Posting-Host: 1cd48dbf.newsspool4.arcor-online.net X-Trace: DXC=EVk\gc7RI`:=FQB?mjjV504IUK On Mon, 2006-12-11 at 19:19 -0800, markww wrote: > I'm wondering still if it's possible to have a data member in the > package definition that serve as my start and end nodes. As Jeffrey and Stuart have explained, you are still led astray by a misconception: A C++ struct/class here corresponds to an Ada type, not to an Ada package. Although you need a package to associate the "methods" with the tagged type, all data members must become the record components in the type definition. C++: From a struct or class, you create objects. Ada: From a type, you create objects. C++: Operations of a type are declared within the struct/class Ada: Operations of a type are declared after the type within a surrounding package. Compare the following definitions: namespace Geo { struct Any { int x, y; virtual void move(int a, int b) = 0; }; struct Point : public Any { virtual void move(int a, int b); }; struct Circle : public Any { int r; virtual void move(int a, int b); }; } package Geo is type Any is abstract tagged record x, y: Integer; -- data members of any geometric object end record; procedure move(thing: in out Any; a, b: Integer) is abstract; -- abstract method of Any type Point is new Any with record null; -- no additional data members end record; --overriding procedure move(thing: in out Point; a, b: Integer); type Circle is new Any with record r: Integer; -- Circle objects with radius end record; --overriding procedure move(thing: in out Circle; a, b: Integer); end Geo; HTH, -- Georg