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,23777acd564d513b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-17 08:11:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!server3.netnews.ja.net!newshost.central.susx.ac.uk!news.bton.ac.uk!not-for-mail From: John English Newsgroups: comp.lang.ada Subject: Re: Problem Eliminating constructors Date: Fri, 17 Jan 2003 15:21:29 +0000 Organization: University of Brighton Message-ID: <3E281F79.A309AD5E@brighton.ac.uk> References: <3e274cad$0$33929$bed64819@news.gradwell.net> NNTP-Posting-Host: straumli.it.bton.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: saturn.bton.ac.uk 1042816808 6666 193.62.183.204 (17 Jan 2003 15:20:08 GMT) X-Complaints-To: news@bton.ac.uk NNTP-Posting-Date: 17 Jan 2003 15:20:08 GMT X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:33136 Date: 2003-01-17T15:20:08+00:00 List-Id: Victor Porton wrote: > > package A is > > type A_Type is tagged > record > X: Integer; > end; > > function Create(X: Integer) return A_Type; -- guess what is the body > > end A; > > Then I have > > type B_Type is new A.A_Type with > record > Y: Integer; > end; > > Compiler requires me to override Create as the return type changes. > But it is meaningless as now I need Create with two parameters > instead of one. > > What to do? Take Create out of package A and make it a child of the package: function A.Create(X: Integer) return A.A_Type is ...; Now Create will no longer be a primitive operation of A_Type since it isn't declared in the same package spec, but you can refer to it in exactly the same way (except you would need "with A.Create" to be able to call it). ----------------------------------------------------------------- John English | mailto:je@brighton.ac.uk Senior Lecturer | http://www.it.bton.ac.uk/staff/je Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS ** University of Brighton | -- see http://burks.bton.ac.uk -----------------------------------------------------------------