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=-0.1 required=5.0 tests=AXB_XMAILER_MIMEOLE_OL_024C2, BAYES_00,MAILING_LIST_MULTI,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5fd1cba526594f4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-10 05:28:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!teaser.fr!enst.fr!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada Subject: Re: Some questions Date: Thu, 10 Oct 2002 07:27:01 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <6c4a2b60cbe5ecf058fadca48f6c6e80.110780@mygate.mailgate.org> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1034252882 91104 137.194.161.2 (10 Oct 2002 12:28:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 10 Oct 2002 12:28:02 +0000 (UTC) Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Original-Cc: sicon@hotmail.com Xref: archiver1.google.com comp.lang.ada:29652 Date: 2002-10-10T07:27:01-05:00 ----- Original Message ----- From: "Sim Con" Newsgroups: comp.lang.ada To: Sent: Thursday, October 10, 2002 6:17 AM Subject: Some questions > the compilator says "child of an instance must be an instance or > renaming", so what's wrong? How can i build custom procedures for print > the generic elements in generic packages??? What you need to do is provide a print procedure when you instantiate the generic. This is done by declaring the generic like this: generic type Item is private; with Procedure Print (I : Item) is <>; package stacks type Stack is private; . procedure Print (S : Stack); . end Stacks; Then, when you instantiate the package, you do it specifying the type if the items in the stack, and a print procedure for that type -- e.g.,: package stack_float is new Stacks (float, print_float); where print_float is your print procedure for the float type. The <> in the generic declaration means that if there is a procedure named Print visible at the point of instantiation, and having a parameter profile matching that of the formal procedure parameter of your generic declaration, then the instantiation can simply be package stack_float is new Stacks (float); because the matching print procedure will be included by default. Then within your implementation of the generic package's Print procedure, you can call the Print (I : Item) procedure for each item in the stack.