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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fcb020a71edc13e4,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-08 05:56:44 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!freenix!proxad.net!feeder2-1.proxad.net!news3-2.free.fr!not-for-mail From: "Bruno" Newsgroups: comp.lang.ada Subject: Problem whith objects, access and abstract tagged private types Date: Thu, 8 Jan 2004 14:58:44 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <3ffd619b$0$22318$626a54ce@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 08 Jan 2004 14:56:43 MET NNTP-Posting-Host: 217.167.42.235 X-Trace: 1073570203 news3-2.free.fr 22318 217.167.42.235:2644 X-Complaints-To: abuse@proxad.net Xref: archiver1.google.com comp.lang.ada:4203 Date: 2004-01-08T14:56:43+01:00 List-Id: Hello to all, I'm newbie in Ada95 and I have some difficulties with the language. I'll give you my specifications : Specif (.ads) : --------------- package Objets is type Item_Type is abstract tagged private; -- Action procedure Traitement (F : in Item_Type); -- Allows init procedure Modifier (F : in out Item_Type'Class; Nb : in Natural); type Item_Elmt is private; function To_Item_Elmt (F : in Item_Type'Class) return Item_Elmt; function To_Item_Type (F : in Item_Elmt) return Item_Type'Class; private type Item_Type is abstract tagged record Compteur : Natural := 0; end record; type Item_Elmt is access all Item_Type'Class; end Objets; I chose private types for hiding implementation of my types and access types. My problem is that I can't make the function "To_Item_Elmt" that create "Item_Elmt". I try to write this body : function To_Item_Elmt (F : in Item_Type'Class) return Item_Elmt is My_Tag : constant Ada.Tags.Tag := F'Tag; begin return new My_Tag' (F); end To_Item_Elmt; The compilation indicates the following errors : subtype mark required in this context found "My_Tag" declared at line 30 If somebody could help and explain me how to resolve my problem, thanks for his help. Bruno