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,da9f9995bafb51df X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.74.201 with SMTP id w9mr7944738pbv.0.1333754021235; Fri, 06 Apr 2012 16:13:41 -0700 (PDT) MIME-Version: 1.0 Path: r9ni26833pbh.0!nntp.google.com!news1.google.com!goblin3!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: deuteros Newsgroups: comp.lang.ada Subject: Re: Assigning a "subclass" instance to a "superclass" variable Date: Fri, 6 Apr 2012 23:13:40 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Fri, 6 Apr 2012 23:13:40 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="QF15JMfcBFrmxWoj0L/Q9g"; logging-data="26312"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DYf8VAg5xQCeZXyK/TQzQ4NBZOnso/Ag=" User-Agent: Xnews/2009.05.01 X-Antivirus-Status: Clean X-Antivirus: avast! (VPS 120406-1, 04/06/2012), Outbound message Cancel-Lock: sha1:GeJxX8yW613PRXunbzAbf35bHJE= Date: 2012-04-06T23:13:40+00:00 List-Id: On Fri 06 Apr 2012 05:50:18p, Simon Wright wrote in news:m2ty0wh6n9.fsf@pushface.org: > with Statements; > package Expressions is > type Expression is new Statements.Statement with record > ... > end record; > function Execute (Skip : Boolean; S : Expression) return Integer; > end Expressions; > > or > > package Statements.Expressions is > type Expression is new Statement with record > ... > end record; > function Execute (Skip : Boolean; S : Expression) return Integer; > end Statements.Expressions; > > The second form is good if the full declaration of Statement is in the > private part of Statements, since child packages can see the private > parts of their parents. Okay, so would I need to put tokens and executedtokens in Expression's record as well or would it somehow inherit them from Statements? I want something like a constructor in my child classes: function Create_Expression (tokens, executedtokens : Vector) return Expression is E : Expression begin E.tokens := tokens; E.executedtokens := executedtokens; return E; end Create_Expression; Now if the Expression package must have its own tokens and executedtokens I assume this would be the way to do it but if not then how would this work?