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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9f3d09bde7b33b5d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-10 03:49:50 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!dialin-145-254-036-234.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Pass by reference Date: Sat, 10 Apr 2004 12:49:34 +0200 Organization: At home Message-ID: References: <19b0e504.0404080652.4eab9f80@posting.google.com> <19b0e504.0404090438.7e800536@posting.google.com> <19b0e504.0404091109.134587c6@posting.google.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-036-234.arcor-ip.net (145.254.36.234) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de 1081594187 94936458 I 145.254.36.234 ([77047]) User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:6943 Date: 2004-04-10T12:49:34+02:00 List-Id: Dan McLeran wrote: >> This need not to be tagged, because there is no dispatching subroutines >> here. A rough C++ equivalent of a tagged type is a class with virtual >> functions. > > Quite right. This is a better example: > > struct Silly > { > virtual int Get() > { > return i; > } > private: > int i; > }; You have to add a friend function, because in C++ Silly will be passed to Get() by reference as in Ada: type Silly is tagged private; function Get (Object : Silly) return Integer; private type Silly is tagged record I : Integer; end record; So the difference between C++ and Ada is rather marginal here. But as I said, I think it would be better to leave the choice to the compiler (in the case of non-limited tagged types.) -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de