comp.lang.ada
 help / color / mirror / Atom feed
* Hiding a type
@ 2002-07-06 17:17 Ryan Tarpine
  2002-07-06 21:30 ` Pat Rogers
  0 siblings, 1 reply; 17+ messages in thread
From: Ryan Tarpine @ 2002-07-06 17:17 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2002-07-08  7:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-06 17:17 Hiding a type Ryan Tarpine
2002-07-06 21:30 ` 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

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