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,b88383a5d9c51aa0 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!news.germany.com!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 25 Mar 2009 12:40:44 +0100 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada-Singleton-Why does it work like this? References: <5a7a870c-40e2-4803-8753-0f9cfd2b800f@k2g2000yql.googlegroups.com> <13su65cm8b5ov$.1198qla32cc3i$.dlg@40tude.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <49ca183c$0$30232$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 25 Mar 2009 12:40:44 CET NNTP-Posting-Host: ebf778aa.newsspool1.arcor-online.net X-Trace: DXC=:E_nX6afn::=FQB?mjjV50ic==]BZ:af>4Fo<]lROoR1^YC2XCjHcb9[b9FcOG[i2<;9OJDO8_SK6NSZ1n^B98i:`Oj15P3^GK; X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:5263 Date: 2009-03-25T12:40:44+01:00 List-Id: patrick.gunia@googlemail.com schrieb: > Yet another question, if my Singleton_Type is unconstrained, why does > Ada allow creating Access-Types to unconstrained types allowing to > access there record-properties, while not allowing to create an > instance of Singleton_Type directly? This is wrong, see below. > if I declare a pointer in C++ I > either have to create a new instance using "new" in heap-memory where > the pointer points to or I have to use references and then let the > pointer point to a reference. Same in Ada. Although, you have to use "aliased" before an object (or have an object that is implicitly aliased) if you want to use C++::&. > In both cases I first have to create an > object and then let the pointer point to it. Same in Ada. > When I use access types > in Ada in my example it�s possible to create a pointer to a class Nitpick: You can't point to a class, only to objects. > which can�t be instantiated, because it is unconstrained. (Nitpick: you instantiate generic units, you create objects.) Objects of type Singleton_Type can be created. They cannot, however, be created outside the package Singleton. HTH