From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Package instance???
Date: Thu, 14 Feb 2002 13:12:32 -0500
Date: 2002-02-14T13:12:32-05:00 [thread overview]
Message-ID: <u6nv6rqn17658a@corp.supernews.com> (raw)
In-Reply-To: OvBYEeMtBHA.1400@cpimsnntpa03
"Yates" <yates_1900@yahoo.com> wrote in message
news:OvBYEeMtBHA.1400@cpimsnntpa03...
> I am new to Ada. I'd like to know if it is possible to create multiple
> instances of a package. For example, if I have a package 'My_Package',
can
> I do something like:
>
> p1 : My_Package := new My_Package
> p2 : My_Package := new My_Package
> .....
>
> I tried this and didn't work. Is there other ways to do it?
A package is not a type, so you can't do this.
You could declare My_Package as a generic, and then make multiple
instantiations:
generic
package GP is ...;
package P1 is new GP;
package P2 is new GP;
which is close to your original example.
Of course, unless you have static data in the package, I am skeptical of
your need to do this. Why isn't declaring an instance of a type adequate?
For example:
package P is
type T is ...;
end;
O1 : P.T;
O2 : P.T;
prev parent reply other threads:[~2002-02-14 18:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-13 19:48 Package instance??? Yates
2002-02-13 22:25 ` Zach Swanson
2002-02-13 22:31 ` Jeffrey Carter
2002-02-14 2:28 ` Zach Swanson
2002-02-14 14:32 ` Marin David Condic
2002-02-14 2:04 ` Bobby D. Bryant
2002-02-14 2:54 ` Steve Doiel
2002-02-14 14:41 ` Marin David Condic
2002-02-15 2:13 ` Steve Doiel
2002-02-14 12:48 ` Marc A. Criley
2002-02-14 15:09 ` Yates
2002-02-14 18:12 ` Matthew Heaney [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox