comp.lang.ada
 help / color / mirror / Atom feed
From: Graham <graham.stark@virtual-worlds.biz>
Subject: Re: using an Ada.Container as a private type
Date: Thu, 3 Apr 2008 09:20:40 -0700 (PDT)
Date: 2008-04-03T09:20:40-07:00	[thread overview]
Message-ID: <1cc05c5f-2c29-46d9-88fc-03c4f8c93029@i12g2000prf.googlegroups.com> (raw)
In-Reply-To: 151julprm1vv4.82a26cafccm6$.dlg@40tude.net

On Apr 3, 5:02 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Thu, 3 Apr 2008 08:29:28 -0700 (PDT), Graham wrote:
> > Hi,
> >     I'm writing a little financial application. I want to model a
> > stream of payments made at arbitrary periods (the periods are positive
> > numbers; they might be actual dates later on).
>
> > I think I want to declare this:
>
> > type Payment_Stream is private;
>
> > procedure Add_To_Payment_Stream(
> >             stream : in out Payment_Stream;
> >             period :  Positive;
> >             amount : Money );
>
> > ......
>
> > and then privately declare the payment stream as an Ordered Map, like:
>
> > private
>
> >    package Payment_Stream_Package is new Ada.Containers.Ordered_Maps(
> >       Element_Type => Money,
> >       Key_Type => Positive );
>
> >    type Payment_Stream is new Payment_Stream_Package.Map;
>
>    type Payment_Stream is new Payment_Stream_Package.Map with null record;
>
> > but I can't do this. Gnat complains that "type derived from tagged
> > type must have extension".
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

Oh, I see (I think..) Thanks very much to both of you.

Graham



  reply	other threads:[~2008-04-03 16:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-03 15:29 using an Ada.Container as a private type Graham
2008-04-03 16:00 ` Robert A Duff
2008-04-03 16:02 ` Dmitry A. Kazakov
2008-04-03 16:20   ` Graham [this message]
2008-04-03 20:41 ` Maciej Sobczak
2008-04-04  8:02   ` Graham
2008-04-04 15:57     ` Adam Beneschan
2008-04-04 17:25     ` Robert A Duff
2008-04-04 19:37       ` Simon Wright
replies disabled

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