comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: Dispatching operations
Date: Wed, 09 Nov 2005 09:38:35 +0100
Date: 2005-11-09T09:38:35+01:00	[thread overview]
Message-ID: <dkscib$cgo$1@sunnews.cern.ch> (raw)
In-Reply-To: <Ba4cf.1331$Xo.933@newsread2.news.pas.earthlink.net>

Jeffrey R. Carter wrote:

>> My confusion is that Op_B is private in P2. X is declared in P2 as 
>> well. In the above call, I'd expect P2.Op_B to be called (which is 
>> actually the case), but since everything is known statically, then I'd 
>> expect as well to get compile-time error due to the fact that P2.Op_B 
>> is private.
> 
> The important point is in 20.f: "The overriding declaration for P2.Op_B 
> is not visible in Main, so the name in the call actually denotes the 
> implicit declaration of Op_B inherited from T1."
> 
> Note that there is an implicit declaration of Op_B in P2 at the point of 
> the type extension.
> 
> Also note that X is not declared in P2; it is declared in Main.

Thanks, this clears thing a bit.

The question remains, though: how can I get compile error when calling 
private P2.Op_B?
If it's not possible, what's the point in making it private?

When I make this operation (P2.Op_B) public, the it hides the one 
inherited from P1.T1 and it is no longer possible to call P2.Op_B(Arg => 
X), because the named association of parameter is wrong. This means that 
by "promoting" something from private to public (!) in the given package 
I can break the existing client of that package.
This is a strange concept to me.


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



  reply	other threads:[~2005-11-09  8:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-08 11:17 Dispatching operations Maciej Sobczak
2005-11-08 12:06 ` christoph.grein
2005-11-08 16:15 ` Jeffrey R. Carter
2005-11-09  8:38   ` Maciej Sobczak [this message]
2005-11-09 22:28     ` Jeffrey R. Carter
replies disabled

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