From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6b1ee86289c4a75e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-08 13:56:48 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.sttls1.wa.home.com.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <9frakn$5qr8r$1@ID-42131.news.dfncis.de> Subject: Re: private properties of tagged records X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Message-ID: Date: Fri, 08 Jun 2001 20:54:15 GMT NNTP-Posting-Host: 24.20.66.39 X-Complaints-To: abuse@home.net X-Trace: news1.sttls1.wa.home.com 992033655 24.20.66.39 (Fri, 08 Jun 2001 13:54:15 PDT) NNTP-Posting-Date: Fri, 08 Jun 2001 13:54:15 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:8453 Date: 2001-06-08T20:54:15+00:00 List-Id: "Thomas Nebel" 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