comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm-host.bauhaus@maps.futureapps.de>
Subject: Re: limited /non-limited tagged type
Date: Fri, 04 Mar 2011 21:10:30 +0100
Date: 2011-03-04T21:10:30+01:00	[thread overview]
Message-ID: <4d714736$0$6979$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <40bfb845-7868-4536-886b-496e8dc82cb4@hd10g2000vbb.googlegroups.com>

On 3/4/11 7:56 PM, Hacid wrote:

> I understand why I can't define my type limited in the public part and
> not limited in the private part. But is there a way to do what I
> want ?
>
> Something like :
>
> package Foo is
>
>     type Object is tagged private;
>
>     function ":=" (Left : out Object,; Right : in Object) is abstract;
> -- I know this looks strange
>
> end Foo;

Maybe something along these lines?

package Foo_3 is

     type Object is tagged limited private;

private

     type Wrapped is record
         null;  -- ...
     end record;

     procedure Copy_Constructor
         (Source :  in Object;
          Target : out Object );

     type Object is tagged limited
         record
             Data : Wrapped;
         end record;

end Foo_3;

package body Foo_3 is

     procedure Copy_Constructor
         (Source :  in Object;
          Target : out Object )
     is
     begin
         Target.Data := Source.Data;
     end Copy_Constructor;

end Foo_3;



  parent reply	other threads:[~2011-03-04 20:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04 18:56 limited /non-limited tagged type Hacid
2011-03-04 19:54 ` Edward Fish
2011-03-04 21:18   ` Hacid
2011-03-05  0:17     ` Edward Fish
2011-03-04 20:10 ` Georg Bauhaus [this message]
2011-03-04 21:55   ` Hacid
2011-03-04 22:21     ` Hacid
2011-03-05  1:20       ` Randy Brukardt
2011-03-04 22:22     ` Georg Bauhaus
2011-03-04 22:40       ` Hacid
2011-03-05  1:29         ` Georg Bauhaus
2011-03-04 23:34 ` Adam Beneschan
2011-03-05  3:26 ` Adam Beneschan
2011-03-05 16:48   ` Hacid
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox