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 w6mr12452882pbg.3.1317327656572; Thu, 29 Sep 2011 13:20:56 -0700 (PDT) Path: lh7ni7727pbb.0!nntp.google.com!news1.google.com!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: Thu, 29 Sep 2011 22:20:24 +0200 Organization: cbb software GmbH Message-ID: <1rj1mmkvwud1d.dzqoy4jhdfca$.dlg@40tude.net> References: <11513972.2788.1317325228383.JavaMail.geo-discussion-forums@yqnv12> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: EMY6V9w2JsuJ/8EEiAFEEw.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:18207 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-09-29T22:20:24+02:00 List-Id: On Thu, 29 Sep 2011 12:40:28 -0700 (PDT), Rego, P. wrote: > So, the packages are declared as > [...] > with Parent_Package; > procedure Parent_Main is > Obj : Parent_Package.Parent_Class_Ptr; > begin > Obj := Obj.Construct; This is equivalent to: Obj := Construct (Obj.all); But Obj is null. > 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; And you don't need it because it has no parameters. Derive Parent_Class from Ada.Finalization.Controlled and override Initialize. P.S. I also see no MI in your design. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de