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,5f0f4bfb0467bb19 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.28.135 with SMTP id b7mr4626965pbh.8.1321115335656; Sat, 12 Nov 2011 08:28:55 -0800 (PST) X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.181.72 Path: h5ni37598pba.0!nntp.google.com!news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!nntpfeed.proxad.net!78.192.181.72.MISMATCH!gegeweb.42!gegeweb.eu!gegeweb.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Constructors with multiple inheritance Date: Sat, 12 Nov 2011 17:28:54 +0100 Organization: cbb software GmbH Message-ID: <1sjf8p6n8qvi5.17sqiogpqnwx5.dlg@40tude.net> References: <11513972.2788.1317325228383.JavaMail.geo-discussion-forums@yqnv12> <1rj1mmkvwud1d.dzqoy4jhdfca$.dlg@40tude.net> <4976045.4489.1317352313370.JavaMail.geo-discussion-forums@yqjw35> <2pu3h5hqltxi$.ze4yrf1f2y8z.dlg@40tude.net> <23774546.1654.1317391464047.JavaMail.geo-discussion-forums@yqnk41> <1gnrks1djlaok.1k0r5f8z9ylfx.dlg@40tude.net> <21605158.153.1320805494018.JavaMail.geo-discussion-forums@yqiu15> <6366850.176.1320896821400.JavaMail.geo-discussion-forums@yqcm23> <27371284.2333.1321111829701.JavaMail.geo-discussion-forums@yqhd1> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: /UEGvvv3iJTp1sBsj2v2og.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news2.google.com comp.lang.ada:14406 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-11-12T17:28:54+01:00 List-Id: On Sat, 12 Nov 2011 07:30:29 -0800 (PST), Rego, P. wrote: >> function Construct (aValue: Integer; aName: Integer) >> return Par_Class is >> begin >> return (theValue => aValue, >> theName => aName); >> end Construct; > > In this case function Construct would behave as a C++ static function (or maybe a friend one?)? That depends on what you mean. In Ada: 1. there is no hidden parameters 2. an operation can be dispatching (virtual) in any combination of parameters and/or result. But an operation cannot be dispatching in more than one type (no multiple dispatch). All tags of dispatching parameters must be same (no multi-methods). 3. there is no static or friend operations as the visibility rules are based on packages. The function Construct above is a primitive operation, it is not a constructor. Constructors in Ada are implicit, they consist of 1. construction of the components (in an unspecified order, recursively); 2. a call to Initialize if the type is a descendant of Ada.Finalization.[Limited_]Controlled. (Overridden bodies of Initialize are not called! I.e. Ada constructors do not traverse derivation path. In short, aggregation is safe, derivation is not; 3. starting all task components. (Note, tasks are not running when Initialize is called!) Destructors act in the reverse order: tasks - Finalize - components. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de