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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bf5045b7cee3d4b X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeder.erje.net!news.osn.de!diablo1.news.osn.de!noris.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: tagged type as generic parameter Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Fri, 4 Jan 2008 15:17:10 +0100 Message-ID: <1c1nwyxkxc82o.1io2gzf0y091c$.dlg@40tude.net> NNTP-Posting-Date: 04 Jan 2008 15:17:09 CET NNTP-Posting-Host: e495a750.newsspool2.arcor-online.net X-Trace: DXC=f5hem\eTaGD[6=1B@oB@@@A9EHlD;3YcB4Fo<]lROoRA4nDHegD_]RE:@3^O]9ma@IDNcfSJ;bb[EIRnRBaCdi On Fri, 04 Jan 2008 14:08:52 +0100, Philippe Tarroux wrote: > Dmitry A. Kazakov a �crit : >> The function A_Data returns Data. It is a primitive operation of Data and >> thus covariant in the result. So when you derive anything from Data, you >> have to override it in order to provide a correct implementation that would >> return the derived type rather than the base. >> > Ok. But does it mean that only the constructor is a primitive operation > of the data type, not the print procedure? In this case why Print > doesn't need to be redefined? Right, the reason why Print need not to be overridden is that it has Data passed in the in-mode. So the caller has Data already constructed elsewhere. For the same reason a procedure with an in-out-mode parameter can be safely inherited too. Considering strictly out-mode parameters, it could be otherwise, in general case. But in Ada tagged types have to be constrained and constructed even when they are outs. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de