From: Ryan Tarpine <rtarpine@hotmail.com>
Subject: Hiding a type
Date: Sat, 06 Jul 2002 17:17:51 +0000
Date: 2002-07-06T17:17:51+00:00 [thread overview]
Message-ID: <3D27263F.7070101@hotmail.com> (raw)
Hello everyone! I have just started learning Ada, and I am trying to
use it on my next (personal) project. That's generally how I learn
things, by jumping in too deep (It worked to teach myself OCaml, so
we'll see how this turns out! :)
What I'm wondering is how to hide a private type under a different,
public name so variables can't be assigned. I'm not sure how to say it
best, so here's the simplest example of it:
package Test is
type Hide is limited private;
private
subtype Hide is Integer;
end Test;
I want to write functions that will return something of type Hide in a
way so clients can't do anything except pass it to other functions. I
also don't want them to know if I change how I implement it. (In my
real program, I'm trying to hide that Foo returns an access type.)
Please tell how I should actually do this
The exact errors I get are
test.ads:2:10: missing full declaration for private type "Hide"
test.ads:4:13: "Hide" conflicts with declaration at line 2
Thanks in advance,
Ryan
next reply other threads:[~2002-07-06 17:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-06 17:17 Ryan Tarpine [this message]
2002-07-06 21:30 ` Hiding a type Pat Rogers
2002-07-06 18:16 ` Ryan Tarpine
2002-07-06 22:49 ` sk
2002-07-06 22:52 ` Frank J. Lhota
2002-07-06 20:38 ` Ryan Tarpine
2002-07-07 10:31 ` Frank J. Lhota
2002-07-07 11:20 ` Simon Wright
2002-07-07 13:58 ` Frank J. Lhota
2002-07-07 22:24 ` Ryan Tarpine
2002-07-07 17:15 ` Jeffrey Carter
2002-07-07 17:58 ` Simon Wright
2002-07-06 23:10 ` chris.danx
2002-07-06 20:21 ` Ryan Tarpine
2002-07-07 1:58 ` Jeffrey Carter
2002-07-08 7:20 ` Preben Randhol
2002-07-06 23:12 ` chris.danx
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox