Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > using an Ada.Co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 9 Topic 5639 of 5696
Post > Topic >>

using an Ada.Container as a private type

by Graham <graham.stark@[EMAIL PROTECTED] > Apr 3, 2008 at 08:29 AM

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;

but I can't do this. Gnat complains that "type derived from tagged
type must have extension".
I'm fairly new to Ada but thought I was getting on top of it! What is
the principal that stops me doing this? What should I do instead?

thanks,

Graham Stark




 9 Posts in Topic:
using an Ada.Container as a private type
Graham <graham.stark@[  2008-04-03 08:29:28 
Re: using an Ada.Container as a private type
Robert A Duff <bobduff  2008-04-03 12:00:24 
Re: using an Ada.Container as a private type
"Dmitry A. Kazakov&q  2008-04-03 18:02:48 
Re: using an Ada.Container as a private type
Graham <graham.stark@[  2008-04-03 09:20:40 
Re: using an Ada.Container as a private type
Maciej Sobczak <see.my  2008-04-03 13:41:10 
Re: using an Ada.Container as a private type
Graham <graham.stark@[  2008-04-04 01:02:30 
Re: using an Ada.Container as a private type
Robert A Duff <bobduff  2008-04-04 13:25:35 
Re: using an Ada.Container as a private type
Simon Wright <simon.j.  2008-04-04 20:37:38 
Re: using an Ada.Container as a private type
Adam Beneschan <adam@[  2008-04-04 08:57:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 5:28:27 CDT 2008.