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,ed4a5cc4016f9101 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!news2.arglkargh.de!noris.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Default value for a record component Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1185052757.500324.16860@22g2000hsm.googlegroups.com> <1185133442.532463.301960@r34g2000hsd.googlegroups.com> <1185218266.914312.155690@n60g2000hse.googlegroups.com> Date: Mon, 23 Jul 2007 21:41:38 +0200 Message-ID: <5met5cfc4qpc$.1ahrdby7cfc32.dlg@40tude.net> NNTP-Posting-Date: 23 Jul 2007 21:41:38 CEST NNTP-Posting-Host: 6e46033d.newsspool4.arcor-online.net X-Trace: DXC=8052g\[8bnVV0Pe9PRnbJ\4IUK On Mon, 23 Jul 2007 12:17:46 -0700, Maciej Sobczak wrote: > On 22 Lip, 23:44, Robert A Duff wrote: > >> If you want to hide both > > The point is I don't. > > The C++ version: > > class T > { > public: > T() : V(getDefault()) {} > > int V; > > private: > static int getDefault(); > }; > > (or even I can hide getDefault in the implementation file completely, > without even mentioning it in the class definition) > >>> Ada needs real constructors, not just initial values. > >> I don't get it. Please explain. > > The visibility of a component and the mechanics of computing its > initial value are orthogonal and should not depend on one another. I > can have completely separate reasons to expose or hide either of them. (see Jeff Carter's post) You are barking at a wrong tree. It looks more like an abstract member interface. So that you could declare that there is an Integer component V in T, while hiding all stuff about its initialization / finalization / reading / writing. Parent's construction is only a part of the problem. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de