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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d80cdc1b3ff5b2f9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-12 06:32:34 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada Subject: Re: Simple Question 3 Date: Fri, 12 Oct 2001 08:33:20 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <9q49v5$6dj$1@trog.dera.gov.uk> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1002893553 28786 137.194.161.2 (12 Oct 2001 13:32:33 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Fri, 12 Oct 2001 13:32:33 +0000 (UTC) Cc: To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.4 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:14386 Date: 2001-10-12T08:33:20-05:00 ----- Original Message ----- From: "Stephen Cole" Newsgroups: comp.lang.ada To: Sent: Thursday, October 11, 2001 9:28 AM Subject: Simple Question 3 > Hi > > Question 3..... > > package MyTstTypes is > type MyRcd is tagged > record > a: Integer; > b: Float; > end record; > > function Unit return MyRcd; > > type MyNewRcd is new MyRcd with > record > c: Integer; > end record; > > -- function Unit return MyNewRcd; > > type MyNewRcd2 is new MyNewRcd with > record > d: Float; > end record; > > end MyTstTypes; > > The compiler complains with the following text.... > > "mytsttypes.ads:10:09: type must be declared abstract or "Unit" overridden" > > It wants me to define a version of Unit() for each derived type?! Why? > Since the function Unit return MyRcd is not classwide, it can only return values of the type MyRcd. If, instead, it were declared as function Unit return MyRcd'Class, then it would be a classwide function and it would return values of the type of the variable to which the function result was being assigned, and the compiler would not complain.