comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Bad influence of private part on what subprograms can be defined
Date: Mon, 9 Oct 2017 02:25:50 -0700 (PDT)
Date: 2017-10-09T02:25:50-07:00	[thread overview]
Message-ID: <e75fde68-c47e-4cac-9299-c2bde6e57e95@googlegroups.com> (raw)
In-Reply-To: <orf8a1$oc2$1@gioia.aioe.org>

Dmitry is correct. The programmer of B has full control about how he is going to implement the type and its operations. There is not any surprise for him about whether an operation would be overriding or not. If he doesn't want X to be overriding, he has to choose a different name. In the latter case, a user of B will not see (will not be able to directly call) the inherited operation although it exists.

  package B is
    type B_Type is tagged private;
  --procedure X (Object: B_Type);  implicitly defined
    procedure Y (Object: B_Type);
  private
    type B_Type is new A.A_Type with null record;
  end;

  package body B is
    procedure Y (Object: B_Type) is
    begin
      X (Object);  -- indirect call of inherited X
    end;
  end;


  reply	other threads:[~2017-10-09  9:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-08 22:52 Bad influence of private part on what subprograms can be defined Victor Porton
2017-10-09  7:25 ` Dmitry A. Kazakov
2017-10-09  9:25   ` AdaMagica [this message]
2017-10-09 10:19     ` AdaMagica
2017-10-09 22:02 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox