From: gautier_niouzes@hotmail.com
Subject: Re: Overriding puzzle
Date: Wed, 30 Dec 2015 10:24:04 -0800 (PST)
Date: 2015-12-30T10:24:04-08:00 [thread overview]
Message-ID: <26e20ae9-ad86-4c88-9c67-f1a4a9b33f23@googlegroups.com> (raw)
In-Reply-To: <c63a98f4-1127-4e7d-852f-ad418a4a749f@googlegroups.com>
No, the "A'Class(o)" also makes the difference when type Custom is framed into a package:
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_override is
package Pkg is
type A is tagged null record;
procedure Header(o: A);
procedure New_Page(o: A);
end;
package body Pkg is
procedure Header(o: A) is
pragma Unreferenced (o);
begin
Put_Line("This is a normal header");
end;
procedure New_Page(o: A) is
begin
Header(A'Class(o));
end;
end;
package Pkg_cust is
type Custom is new Pkg.A with null record;
procedure Header(o: Custom);
end;
package body Pkg_cust is
procedure Header(o: Custom) is
pragma Unreferenced (o);
begin
Put_Line("This is a custom header");
end;
end;
use Pkg_cust;
obj: Custom;
begin
New_Page(obj);
end;
_________________________
Gautier's Ada programming
http://www.openhub.net/accounts/gautier_bd
next prev parent reply other threads:[~2015-12-30 18:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-30 14:49 Overriding puzzle gautier_niouzes
2015-12-30 15:10 ` Egil H H
2015-12-30 17:31 ` gautier_niouzes
2015-12-30 18:07 ` marciant
2015-12-30 18:24 ` gautier_niouzes [this message]
2015-12-30 21:40 ` marciant
2015-12-30 23:10 ` Randy Brukardt
2015-12-31 8:22 ` Niklas Holsti
2015-12-31 8:42 ` Dmitry A. Kazakov
2016-01-03 7:18 ` Randy Brukardt
2015-12-31 16:30 ` marciant
2015-12-30 23:13 ` 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