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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,901038687c38f61c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: Idiom for a class and an object in Ada References: <417831f8$0$36214$39cecf19@news.twtelecom.net> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 22 Oct 2004 00:10:48 GMT NNTP-Posting-Host: 64.185.133.124 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1098403848 64.185.133.124 (Thu, 21 Oct 2004 17:10:48 PDT) NNTP-Posting-Date: Thu, 21 Oct 2004 17:10:48 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:5606 Date: 2004-10-22T00:10:48+00:00 List-Id: "Matthew Heaney" writes: > "Kevin Cline" wrote in message > news:e749549b.0410211131.6505da@posting.google.com... > > > > class AD_Converter > > { > > private: > > > > AD_Converter(int line) {} > > public: > > static AD_Converter Noise; > > }; > > > > AD_Converter AD_Converter::Noise(17); > > Yes, indeed. I should have made this more clear. > > Actually, directly translating the C++ code above to Ada is a little > tricky, since you can't declare object Noise until the full view of > the type has been declared. I realized on my drive home that I forgot this one: package AD_Converters is type AD_Converter (<>) is limited private; procedure Op (ADC : AD_Converter); Noise : constant AD_Converter; private type Rep_Type is limited record ... end record; type AD_Converter is access all Rep_Type; for AD_Converter'Storage_Size use 0; Noise_Object : aliased Rep_Type; Noise : constant AD_Converter := Noise_Object'Access; end AD_Converters;