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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Strange error message Date: Sun, 1 Jun 2014 13:11:08 +0200 Organization: cbb software GmbH Message-ID: References: <33e17033-615d-43d4-8b47-9357c8875a10@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: AuYlnUSfTZrfhAkRjyySpQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:20101 Date: 2014-06-01T13:11:08+02:00 List-Id: On Sun, 1 Jun 2014 03:24:02 -0700 (PDT), Charly wrote: > when I defined a class hierarchy I encountered a problem, that I could reduce > to the following few lines: > > This version compiles without problems: > ----------------- > package Test is > > type Base is tagged private; > function Create return Base; > > type High is new Base with private; You must override Create for High, *always*. > Why do I have to overide the function Create for type High. > I don't see the necessity. > > Btw. I'm using GNAT GPL 2014 but the same happens with 2013 version. I believe it was a recent hack (wrongly) added to Ada that you need not to override primitive operations returning the tagged type when the derived type does not actually extend. I don't know if making that public or privately changes anything. You did that privately. It is an awful idea in any form. You should always override such operations, and all out-operations, because inheriting them is a priori unsafe. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de