From: "Rick Santa-Cruz" <rick_santa_cruz75@msn.com>
Subject: implicit cast and inheritance
Date: Fri, 1 Oct 2004 22:50:02 +0200
Date: 2004-10-01T22:50:02+02:00 [thread overview]
Message-ID: <cjkfuc$j5s$03$1@news.t-online.com> (raw)
Hi,
I have a small question. See the following source-code:
package Pack is
type Base is tagged
record
Value: Integer;
end record;
procedure Base_Proc(B: Base);
type Derived is new Base with
null record;
end Pack;
And now I have the following source for the main-procedure:
with Pack;
use Pack;
procedure main is
B: Base;
D: Derived;
procedure Proc(B: Base) is
begin
null;
end Proc;
begin
Pack.Base_Proc(B); -- 1
Pack.Base_Proc(D); -- 2
Proc(B); -- 3
Proc(D); -- 4
end main;
It is clear to me, that the (4) won't compile, but I can solve it in making
a cast or defining Proc with 'Class. My question is now why I can call
Base_Proc(D). It is clear to me that the class Derived inherit the
Base_Proc-Procedure from its base-class, but what is with the parameter? Why
does this work?
I have a suggestion why this works... cause it is in the same package... but
how does it internly work? If it is in the same package, is then always
implicitly done a cast, or is the procedure Base_Proc in the derived class
"Derived" automatically defined with a parameter Type "Derived"?
Thanks a lot in advance,
Rick
next reply other threads:[~2004-10-01 20:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-01 20:50 Rick Santa-Cruz [this message]
2004-10-02 0:09 ` implicit cast and inheritance Stephen Leake
2004-10-02 16:32 ` Rick Santa-Cruz
2004-10-02 21:35 ` Stephen Leake
2004-10-02 22:05 ` Rick Santa-Cruz
2004-10-03 10:23 ` Marius Amado Alves
2004-10-03 13:27 ` CBFalconer
2004-10-03 12:32 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox