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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.159.227 with SMTP id xf3mr3935019pab.27.1430987674352; Thu, 07 May 2015 01:34:34 -0700 (PDT) X-Received: by 10.140.34.182 with SMTP id l51mr40444qgl.8.1430987674087; Thu, 07 May 2015 01:34:34 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!l13no15004121iga.0!news-out.google.com!t92ni189qga.1!nntp.google.com!j5no5800177qga.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 7 May 2015 01:34:33 -0700 (PDT) In-Reply-To: <5hbl45anxasb.1jn73i00zgy2i.dlg@40tude.net> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.251.73.50; posting-account=O3LyFwoAAACc1uh60ZcOUmAGdDmGsEcV NNTP-Posting-Host: 193.251.73.50 References: <5hbl45anxasb.1jn73i00zgy2i.dlg@40tude.net> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0aa1e297-7d67-4ae5-819b-e4c6ece1d9f1@googlegroups.com> Subject: Re: Polymorphism From: slos Injection-Date: Thu, 07 May 2015 08:34:34 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:25749 Date: 2015-05-07T01:34:33-07:00 List-Id: Le jeudi 7 mai 2015 09:41:55 UTC+2, Dmitry A. Kazakov a =E9crit=A0: > On Wed, 6 May 2015 16:05:28 -0700 (PDT), slos wrote: >=20 > > Please consider the following simple case : > >=20 > > package Object is > [...] =20 > > end Circle; > >=20 > > I'd like function Object.Area to stay private but the compiler doesn't = see > > it like that and complains if I try to move it in the private part. > >=20 > > In other words, I'd like to not expose internals to clients of the pack= age. > >=20 > > Any hint to achieve that ? >=20 > If you privately override anything for something that is publicly > dynamically polymorphic [~tagged], then that is not any private because y= ou > can [and must] be able to call the overriding body. >=20 > The Ada's types model is that Circle.Instance has the function Area anywa= y. > It is either implemented per inheritance of the parent's type > implementation (if exists) or by providing a new body per overriding. Thu= s > moving overriding into private changes nothing. >=20 > I don't know why it is not allowed. Moreover, it probably would make sens= e > to move all declarations of overriding into private or even further into > the package body because the fact of overriding is mere an implementation > detail, since the primitive subroutine is there anyway no matter what. >=20 > --=20 > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de Thank you Dmitry for your answer. BR, St=E9phane