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-13 18:54:06 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn4feed!wn1feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: "Steve Doiel" Newsgroups: comp.lang.ada References: Subject: Re: Package instance??? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: NNTP-Posting-Host: 12.225.227.101 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1013655243 12.225.227.101 (Thu, 14 Feb 2002 02:54:03 GMT) NNTP-Posting-Date: Thu, 14 Feb 2002 02:54:03 GMT Organization: AT&T Broadband Date: Thu, 14 Feb 2002 02:54:03 GMT Xref: archiver1.google.com comp.lang.ada:19991 Date: 2002-02-14T02:54:03+00: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? > Just to round out the discussion, yes you can do something kind of like that, but that's probably not what your really want.... If your current package is defined as: package My_Package is ... your package spec declarations here end My_Package; package body My_Package is ... your package implementation code here end My_Package; You can change your package spec to: generic package My_Package is ... your package spec declarations here end My_Package; And then you can define: p1 is new My_Package; p2 is new My_Package; Which will create two instances of a My_Package. I don't know your background, but if you have C++ for comparison a generic in Ada is kind of like a template in C++, not an object. I hope this helps, SteveD > Thanks > > Yates > >