From: "Bruno" <b.santo@free.fr>
Subject: Problem whith objects, access and abstract tagged private types
Date: Thu, 8 Jan 2004 14:58:44 +0100
Date: 2004-01-08T14:56:43+01:00 [thread overview]
Message-ID: <3ffd619b$0$22318$626a54ce@news.free.fr> (raw)
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
next reply other threads:[~2004-01-08 13:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-08 13:58 Bruno [this message]
2004-01-08 14:56 ` Problem whith objects, access and abstract tagged private types Georg Bauhaus
2004-01-08 15:22 ` Dmitry A. Kazakov
2004-01-08 18:31 ` Jeffrey Carter
-- strict thread matches above, loose matches on Subject: below --
2004-01-08 14:51 amado.alves
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox