From: "Pat Rogers" <progers@classwide.com>
Subject: Re: Hiding a type
Date: Sat, 06 Jul 2002 21:30:43 GMT
Date: 2002-07-06T21:30:43+00:00 [thread overview]
Message-ID: <7kJV8.2438$gy3.1099236449@newssvr12.news.prodigy.com> (raw)
In-Reply-To: 3D27263F.7070101@hotmail.com
"Ryan Tarpine" <rtarpine@hotmail.com> wrote in message
news:3D27263F.7070101@hotmail.com...
> 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! :)
Do check out a textbook from the library -- it is worth the time -- or
take one of the on-line tutorials. See www.adapower.com.
> 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:
<snip>
> 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
package Opaque is
type Hidden is limited private;
-- declare the operations here that you want to export to clients
private
type Hidden is access all Integer;
end Opaque;
--
Patrick Rogers Consulting and Training in:
http://www.classwide.com Real-Time/OO Languages
progers@classwide.com Hard Deadline Schedulability
Analysis
(281)648-3165 Software Fault Tolerance
next prev parent reply other threads:[~2002-07-06 21:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-06 17:17 Hiding a type Ryan Tarpine
2002-07-06 21:30 ` Pat Rogers [this message]
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