comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: using an Ada.Container as a private type
Date: Fri, 4 Apr 2008 08:57:55 -0700 (PDT)
Date: 2008-04-04T08:57:55-07:00	[thread overview]
Message-ID: <aa86e26a-51d0-464e-a618-1b6e5b7f57f9@o1g2000pra.googlegroups.com> (raw)
In-Reply-To: d11799dc-566d-412e-a4f0-356f4780602f@t54g2000hsg.googlegroups.com

On Apr 4, 1:02 am, Graham <graham.st...@virtual-worlds.biz> wrote:
> On Apr 3, 9:41 pm, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
>
>
>
> > On 3 Kwi, 17:29, Graham <graham.st...@virtual-worlds.biz> wrote:
>
> > >    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;
>
> > Instead of a solution, I have a question:
>
> > Why do you derive from Map? Which operations of Map do you plan to
> > override?
>
> > Do you ever plan to pass Payment_Stream where
> > Payment_Stream_Package.Map'Class is expected? What effect would you
> > like to achieved this way?
>
> > Why derivation and not composition?
>
> > --
> > Maciej Sobczak *www.msobczak.com*www.inspirel.com
>
> Good question. The intention was not to derive from Map at all: I
> simply wanted to keep the fact that it was implemented as a Map
> private. Is there a better way of doing that, or is keeping it private
> overdesign?

No, that's the sort of thing you're supposed to do.  If you had
derived it in the visible (public) part, you're telling all users of
the package that all the operations available on
Payment_Stream_Package.Map are available for a Payment_Stream, and
that's apparently not what you want.  So doing what you did is the
right thing.

I suspect Maciej just missed the fact that the derived type
declaration was in the private part.

                                 -- Adam



  reply	other threads:[~2008-04-04 15:57 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
2008-04-03 20:41 ` Maciej Sobczak
2008-04-04  8:02   ` Graham
2008-04-04 15:57     ` Adam Beneschan [this message]
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