* private properties of tagged records
@ 2001-06-08 19:56 Thomas Nebel
2001-06-08 20:54 ` Mark Lundquist
2001-06-09 7:44 ` Thomas Nebel
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Nebel @ 2001-06-08 19:56 UTC (permalink / raw)
Hi
Is there a possibility to make properties of a tagged record "private"?;
that you can
access these properties only from a view functions, that have the exclusive
"right"
to access them?
Otherwise every function could change values in evrey record...
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: private properties of tagged records
2001-06-08 19:56 private properties of tagged records Thomas Nebel
@ 2001-06-08 20:54 ` Mark Lundquist
2001-06-08 21:14 ` Ted Dennison
2001-06-09 17:41 ` Robert A Duff
2001-06-09 7:44 ` Thomas Nebel
1 sibling, 2 replies; 6+ messages in thread
From: Mark Lundquist @ 2001-06-08 20:54 UTC (permalink / raw)
"Thomas Nebel" <thomas_nebel@gmx.de> wrote in message
news:9frakn$5qr8r$1@ID-42131.news.dfncis.de...
> Hi
>
> Is there a possibility to make properties of a tagged record "private"?;
> that you can
> access these properties only from a view functions, that have the
exclusive
> "right"
> to access them?
> Otherwise every function could change values in evrey record...
>
> Thomas
It looks like this:
package Foo is
type T is private; -- This means clients of the
package can't see the full type
-- type definition
procedure Do_Something (To : T);
private
type T is record -- This is normal record
definition, but it "completes" the private
-- whatever... -- type declaration above
--
end record;
end Foo;
Now, the full definition of T is visible only in the body of Foo. So for
instance, procedure Do_Something can access the components of its parameter
To, but some other package that with's Foo cannot access to components of an
object of type T.
Note that:
1) A private type does not have to be a record type, it can be any kind of
type.
2) Ada has no notion of private vs. public components; either the type is
private or it isn't.
Does this help?
Mark Lundquist
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: private properties of tagged records
2001-06-08 19:56 private properties of tagged records Thomas Nebel
2001-06-08 20:54 ` Mark Lundquist
@ 2001-06-09 7:44 ` Thomas Nebel
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Nebel @ 2001-06-09 7:44 UTC (permalink / raw)
Thank you !
It works.
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2001-06-11 23:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-08 19:56 private properties of tagged records Thomas Nebel
2001-06-08 20:54 ` Mark Lundquist
2001-06-08 21:14 ` Ted Dennison
2001-06-09 17:41 ` Robert A Duff
2001-06-11 23:08 ` Georg Bauhaus
2001-06-09 7:44 ` Thomas Nebel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox