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.27.230 with SMTP id w6mr15548188pbg.3.1317368155766; Fri, 30 Sep 2011 00:35:55 -0700 (PDT) Path: lh7ni8122pbb.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Constructors with multiple inheritance Date: Fri, 30 Sep 2011 09:36:20 +0200 Organization: cbb software GmbH Message-ID: <2pu3h5hqltxi$.ze4yrf1f2y8z.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> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.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: news1.google.com comp.lang.ada:18222 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-09-30T09:36:20+02:00 List-Id: On Thu, 29 Sep 2011 20:11:53 -0700 (PDT), Rego, P. wrote: >> This is equivalent to: >> >> Obj := Construct (Obj.all); >> >> But Obj is null. > Yes, I agree. But that's the point. I want to reserve the address (so I > can build my queues from there). The problem is not the result, but the argument of Construct. >>> So, how can I fix this? >> >> I don't understand your design, but a constructing function of a >> non-limited type is just: >> >> function Construct return Parent_Class; > It works (and the current code utilizes this approach), but I cannot name > it a method, "method" is not an Ada term, but from the OO point of view Construct is a method, because it is covariant in the result. > since I cannot call the funtion from inside the class, using > something like Object.Method. X.Op is just a syntactic sugar for Op (X). It has nothing to do with an operation being a method or not, except that in Ada the sugar is allowed only for certain types of methods, rather than universally. (The operation Op is a method of the type T in one of its arguments or the result, when the type of that argument or result is T and Op is covariant in it.) > So I need to fix the > package.function_constructor call and use a call of type > object.method_constructor. Why? What is wrong with the abstract factory pattern? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de