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,308a261188818cce X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!z28g2000prd.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Pointers explained? Date: Mon, 30 Jul 2007 15:20:56 -0700 Organization: http://groups.google.com Message-ID: <1185834056.927503.30620@z28g2000prd.googlegroups.com> References: <1185817996.143086.317990@g12g2000prg.googlegroups.com> <1185818189.689914.159900@x40g2000prg.googlegroups.com> <1185824195.711745.136860@i13g2000prf.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1185834057 17242 127.0.0.1 (30 Jul 2007 22:20:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 30 Jul 2007 22:20:57 +0000 (UTC) In-Reply-To: <1185824195.711745.136860@i13g2000prf.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: z28g2000prd.googlegroups.com; posting-host=66.126.103.122; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:1280 Date: 2007-07-30T15:20:56-07:00 List-Id: On Jul 30, 12:36 pm, I wrote while half-asleep: > A couple things I might point out: First, if you have a factory > function [say Create_Message] that returns Message'Class (i.e. *not* a > pointer), you can declare variables of type Message'Class as long as > you use the function (or some other function call, maybe) as an > initializer: > > Var1 : Message'Class := Create_Message (...); > > When you do this, Create_Message can return any type derived from > Message. At that point, the program will determine how much space is > needed for Var1 and allocate it. Var1's type can't be changed after > that, though; if Create_Message returns a Message_3, Var1's type will > be fixed at Message_3, and you can't, say, assign > > Var1 := Y; > > unless Y also happens to have type Message_3. (If it's the wrong > type, a Constraint_Error exception will be raised.) This applies to > record components also No, it doesn't. My bad. Record components have to have definite subtypes. Sorry---I should have tried it first to make sure. -- Adam