comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Ada-Singleton-Why does it work like this?
Date: Wed, 25 Mar 2009 12:40:44 +0100
Date: 2009-03-25T12:40:44+01:00	[thread overview]
Message-ID: <49ca183c$0$30232$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <b9c4d7ef-1d5b-4a87-a018-e0d37663e3dd@e35g2000yqc.googlegroups.com>

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



  reply	other threads:[~2009-03-25 11:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24 19:01 Ada-Singleton-Why does it work like this? patrick.gunia
2009-03-24 19:10 ` Pascal Obry
2009-03-24 20:47 ` Jeffrey R. Carter
2009-03-25  0:10   ` Martin
2009-03-25  0:41     ` Jeffrey R. Carter
2009-03-25  9:30     ` Dmitry A. Kazakov
2009-03-26  8:55       ` Martin
2009-03-26  9:28         ` Dmitry A. Kazakov
2009-03-26 13:39           ` Maciej Sobczak
2009-03-26 14:07             ` Georg Bauhaus
2009-03-26 14:33               ` Dmitry A. Kazakov
2009-03-26 15:22                 ` Georg Bauhaus
2009-03-26 16:31                   ` Dmitry A. Kazakov
2009-03-26 14:28             ` Dmitry A. Kazakov
2009-03-26 22:00               ` Maciej Sobczak
2009-03-27 10:02                 ` Dmitry A. Kazakov
2009-03-25 22:29   ` sjw
2009-03-24 20:52 ` Ludovic Brenta
2009-03-25  9:59   ` patrick.gunia
2009-03-25 10:29     ` Jean-Pierre Rosen
2009-03-25 11:26     ` Georg Bauhaus
2009-03-25 11:49       ` patrick.gunia
2009-03-29  7:29     ` Jacob Sparre Andersen
2009-03-24 21:21 ` Dmitry A. Kazakov
2009-03-25 10:07   ` patrick.gunia
2009-03-25 10:57     ` patrick.gunia
2009-03-25 11:40       ` Georg Bauhaus [this message]
2009-03-25 11:46       ` Ludovic Brenta
2009-03-25 11:55         ` patrick.gunia
2009-03-25 14:10         ` patrick.gunia
2009-03-25 14:40           ` Ludovic Brenta
2009-03-25 15:16             ` Adam Beneschan
2009-03-25 15:19             ` patrick.gunia
2009-03-25 16:52               ` Georg Bauhaus
2009-03-25 11:10     ` Dmitry A. Kazakov
2009-03-25 11:37       ` patrick.gunia
2009-03-25 12:07         ` Ludovic Brenta
2009-03-25 15:00         ` Robert A Duff
2009-03-25 11:17     ` Jean-Pierre Rosen
2009-03-26  9:04       ` Martin
2009-03-25 11:38     ` Ludovic Brenta
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox