From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,95971bf29a745ff4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-14 10:07:24 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Package instance??? Date: Thu, 14 Feb 2002 13:12:32 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:20015 Date: 2002-02-14T13:12:32-05:00 List-Id: "Yates" 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;