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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,704b8962c968e4b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-01 07:13:37 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: new/free of abstract types Date: 1 Apr 2003 07:13:36 -0800 Organization: http://groups.google.com/ Message-ID: <1ec946d1.0304010637.440383a6@posting.google.com> References: <3e87f119$1@news.wineasy.se> <1ec946d1.0303310759.5c6babbb@posting.google.com> <3e894e2b$1@news.wineasy.se> NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1049210016 22984 127.0.0.1 (1 Apr 2003 15:13:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 1 Apr 2003 15:13:36 GMT Xref: archiver1.google.com comp.lang.ada:35861 Date: 2003-04-01T15:13:36+00:00 List-Id: "Frank" wrote in message news:<3e894e2b$1@news.wineasy.se>... > > > It is just that it looks as if I want to initialise the new object with the > values from the parameter one. It wasn't clear from your original example whether you wanted to initialize the newly allocated object from the subprogram parameter. If may be the case that you only need the tag of the object, and not the object itself. You could introduce a level of indirection using a factory method: type T is abstract tagged null record; type T_Class_Access is access all T'Class; function New_T (Dummy : T) return T_Class_Access is abstract; Each type that derives from T can then override New_T, to return a newly allocated object of that same type, e.g. type NT is new T with null record; function New_T (Dummy : NT) return T_Class_Access is begin return new NT; --ignore Dummy object end; > As you may notice I have the parameter as "out" mode. This prototyping gives > me the impression that someting is sent in to > the subprogram still (tag perhaps?). Is it a problem for me to use only > "out" in this parameter or should I use "in out"? Use out if you're definately going to assign to the parameter. Use inout if you're only going to conditionally assign to the parameter.