From: "chris.danx" <spamoff.danx@ntlworld.com>
Subject: why does this work? private new types.
Date: Mon, 6 May 2002 15:24:21 +0100
Date: 2002-05-06T15:24:21+01:00 [thread overview]
Message-ID: <MmwB8.927$hg3.319129@news11-gui.server.ntli.net> (raw)
Hi,
This example code will explain it better than I can.
with hash_tables; -- generic
package blah is
subtype word is string (some_range);
type table is private;
procedure add (a : in word;
t : in out table);
...
private
... -- some functions in here
package tables is new hash_tables
(items => word,
size => 100, -- for quickyness!
hash_function => hash_function,
equals => equals, to_string => to_string);
type table is new tables.hash_table;
end blah;
package body blah is
procedure add (a : in word;
t : in out table) is
begin
insert (a, t); -- *** here ***
end add;
end blah;
insert is defined in hash_tables, so why can it be used in the body of blah
without "using" it? Is it implicitly "used" when table is defined as a
'new' hash_table (i.e. it's allowed to be used . That'd kindof make sense,
but is this the correct way to think of it, or is there a better way?
Seems like you learn new things about Ada every day!
Thanks,
Chris
next reply other threads:[~2002-05-06 14:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-06 14:24 chris.danx [this message]
2002-05-06 14:57 ` why does this work? private new types Jean-Pierre Rosen
2002-05-06 15:28 ` chris.danx
2002-05-09 17:05 ` Kai Schuelke
2002-05-09 17:17 ` David C. Hoos
2002-05-09 17:29 ` Stephen Leake
2002-05-10 2:14 ` Jeffrey 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