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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ccb21d128bf5f2ae X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: newbie - OOP in Ada Set and Get Methods Date: Wed, 29 Dec 2004 20:12:32 +0100 Organization: None Message-ID: <3344921.iUdLNaQEhh@linux1.krischik.com> References: <1104237673.373489.128290@z14g2000cwz.googlegroups.com> <1104251213.061878.187430@f14g2000cwb.googlegroups.com> <1104255406.015130.138150@z14g2000cwz.googlegroups.com> <1104314768.942556.71380@z14g2000cwz.googlegroups.com> Reply-To: martin@krischik.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1104393053 04 28768 1gmsrq4JBi1ESRvW 041230 07:50:53 X-Complaints-To: usenet-abuse@t-online.de X-ID: GzfU3GZe8ead-gat87f1usUl5Im-DmN14fb75v32zFJ2XtPg94rrEw User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:7315 Date: 2004-12-29T20:12:32+01:00 List-Id: R wrote: > my compiler gnatmake Linux > gave me warnings in this function: > > function Set(this: rec1; s: Integer) return Integer is > begin > this.field := s; > return s; > end Set; > > 'in parameters cannot be modified inside function'(sth like this), > when I was using rec1_Typeas an access to rec1 > this warning never occured Declare it "in out" if you want to make changes: function Set(this: in out rec1; s: Integer) return Integer is > but finally i changed it to: > procedure Set(this: in out rec1; s: Integer) is > begin > this.field := s; > end Set; > and now it works fine - no warning > > best regards R Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com