comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <martin@krischik.com>
Subject: Re: newbie - OOP in Ada Set and Get Methods
Date: Wed, 29 Dec 2004 20:12:32 +0100
Date: 2004-12-29T20:12:32+01:00	[thread overview]
Message-ID: <3344921.iUdLNaQEhh@linux1.krischik.com> (raw)
In-Reply-To: 1104314768.942556.71380@z14g2000cwz.googlegroups.com

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



  parent reply	other threads:[~2004-12-29 19:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-28 12:41 newbie - OOP in Ada Set and Get Methods R
2004-12-28 13:36 ` Jeff C r e e.m
2004-12-28 16:26   ` R
2004-12-28 17:01     ` Jeff C r e e.m
2004-12-28 17:30       ` R
2004-12-28 17:20     ` Martin Dowie
2004-12-28 17:36       ` R
2004-12-28 19:47         ` Mark Lorenzen
2004-12-28 19:48         ` Adrien Plisson
2004-12-28 19:58         ` Georg Bauhaus
2004-12-28 21:17         ` Martin Dowie
2004-12-29 10:06           ` R
2004-12-29 12:33             ` Martin Dowie
2004-12-29 17:35             ` Georg Bauhaus
2004-12-29 19:12             ` Martin Krischik [this message]
2004-12-30 12:14               ` Georg Bauhaus
2004-12-29 19:11         ` Martin Krischik
2004-12-28 13:39 ` Martin Krischik
replies disabled

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