* newbie - OOP in Ada Set and Get Methods
@ 2004-12-28 12:41 R
2004-12-28 13:36 ` Jeff C r e e.m
2004-12-28 13:39 ` Martin Krischik
0 siblings, 2 replies; 18+ messages in thread
From: R @ 2004-12-28 12:41 UTC (permalink / raw)
Hello.
I'm new to Ada95. I was trying to create on 'object' in Ada with Set
and Get methods.
But I failed...
I'm not sure whether or not my thinking in Ada is proper - Ada verries
a lot from C++ and Java OOP...
My codes are below
thanks in advance
best regards R
main.db unit:
with Text_IO;
use Text_IO;
with testclass;
procedure Main is
T: testclass.rec1;
begin
T.Set(5);
Put_Line(Integer'Image(T.Get));
end Main;
testclass.ads:
package testclass is
type rec1 is tagged null record; --is abstract
field: Integer;
function Set(s: Integer) return Integer;
function Get return Integer;
end testclass;
and testclass.adb
package body testclass is
function Set(s: Integer) return Integer is
begin
field := s;
return field;
end Set;
function Get return Integer is
begin
return field;
end Get;
end testclass;
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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 13:39 ` Martin Krischik
1 sibling, 1 reply; 18+ messages in thread
From: Jeff C r e e.m @ 2004-12-28 13:36 UTC (permalink / raw)
You probably need to step back and read a few of the Ada tutorials rather
than trying to hack-and-whack
C++ in Ada.
First, I hate to plug this website because it is old and unmaintained and
should be shutdown....But this
tutorial is short and is a very good starting point
http://www.adahome.com/Ammo/cpp2ada.html
A few tips to think about
1) Packages are closer to namespaces than classes.
Your "field" variable is essentially just a stand alone 'global' value
that is in no way tied to your class
2) Tagged records are closer to "classes"
3) There is no "this" in Ada so if you want an object to be visible within a
subprogram it needs to be a parameter.
4) There is no special notation for OO calls v.s. non-OO calls in Ada and
therefore (currently) you do not call a subprogram
with object.method style but rather package.subprogram just as you would
do for non-OO code. Ada 2005 will (probably)
be adding object.method mostly because it really seems to be a hard
thing for people from other programming lanaguages
to swallow (my opinion. I have not seen any really strong technical
argument for the feature..but perhaps there is one)
After reading a few of the articles at adahome, you can ignore it and start
using www.adapower.com
and www.adaworld.com which are actually up to date.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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 13:39 ` Martin Krischik
1 sibling, 0 replies; 18+ messages in thread
From: Martin Krischik @ 2004-12-28 13:39 UTC (permalink / raw)
R wrote:
> Hello.
>
> I'm new to Ada95. I was trying to create on 'object' in Ada with Set
> and Get methods.
>
> But I failed...
>
> I'm not sure whether or not my thinking in Ada is proper - Ada verries
> a lot from C++ and Java OOP...
>
> My codes are below
>
> thanks in advance
>
> best regards R
>
> main.db unit:
>
> with Text_IO;
> use Text_IO;
> with testclass;
> procedure Main is
> T: testclass.rec1;
> begin
> T.Set(5);
> Put_Line(Integer'Image(T.Get));
> end Main;
>
> testclass.ads:
> package testclass is
>
> type rec1 is tagged null record; --is abstract
If you want an abstract class you should say so:
type rec1 is abstract tagged null record:
Of corse when testclass is abstract then you need a non abstract
testclass_2 :-). So maybe you don't want an abstract class after all.
> field: Integer;
field should be part of record "rec1" otherwise it is "static" to use C++
talk!
> function Set(s: Integer) return Integer;
> function Get return Integer;
function Set(s: Integer) return Integer is abstract;
function Get return Integer is abstract;
>
> end testclass;
>
> and testclass.adb
> package body testclass is
> function Set(s: Integer) return Integer is
> begin
> field := s;
> return field;
> end Set;
>
> function Get return Integer is
> begin
> return field;
> end Get;
> end testclass;
Where did you actualy fail?
Suggested Reading:
http://en.wikibooks.org/wiki/Programming:Ada:OO
http://en.wikibooks.org/wiki/Programming:Ada:Types:record
With Regards
Martin
--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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:20 ` Martin Dowie
0 siblings, 2 replies; 18+ messages in thread
From: R @ 2004-12-28 16:26 UTC (permalink / raw)
Jeff C r e e.m wrote:
> A few tips to think about
>
> 1) Packages are closer to namespaces than classes.
> Your "field" variable is essentially just a stand alone 'global'
value
> that is in no way tied to your class
>
> 2) Tagged records are closer to "classes"
so if my class has 7 varaibles(3 of them are dynamically allocated
arrays) they should be all included inside tagged record?
That means that when im creating an object I have to pass as parameters
all
the variables?
> 3) There is no "this" in Ada so if you want an object to be visible
within a
> subprogram it needs to be a parameter.
thanks, I didn't know that
And one more thing about the tutorial which You said should be
shutdown.
It's written there that there is no such thing as contructor.
You'll have to define this function yourself.
so if I want create an object you should write sth like this:
object : testclass.rec1_Type := testclass.Create(10);
how should Create body look like?
rec1_Type is access to rec1 defined as tagged record with one variable
'field'.
when I wrote(package testclass):
function Create(s: Integer) return rec1_Type is
begin
return testclass.rec1_Type(field=>s);
end Create;
gnatmake gave me an error:
$ gnatmake main.adb
gcc -c testclass.adb
testclass.adb:5:33: invalid prefix in call
gnatmake: "testclass.adb" compilation error
where 5th line points to the return statement:
return testclass.rec1_Type(field=>s);
what am I doing wrong?
sorry... I'm just a Ada newbie
best regards R
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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
1 sibling, 1 reply; 18+ messages in thread
From: Jeff C r e e.m @ 2004-12-28 17:01 UTC (permalink / raw)
"R" <ruthless@poczta.onet.pl> wrote in message
news:1104251213.061878.187430@f14g2000cwb.googlegroups.com...
> Jeff C r e e.m wrote:
>> A few tips to think about
>>
>> 1) Packages are closer to namespaces than classes.
>> Your "field" variable is essentially just a stand alone 'global'
> value
>> that is in no way tied to your class
>>
>> 2) Tagged records are closer to "classes"
>
> so if my class has 7 varaibles(3 of them are dynamically allocated
> arrays) they should be all included inside tagged record?
In one way or another yes. Perhaps only in the private section of the
package or in some
cases by declaring an incomplete pointer to the remaining structure and then
filling out the
rest in the body.
>
> That means that when im creating an object I have to pass as parameters
> all
> the variables?
I don't really follow that question.
>
>> 3) There is no "this" in Ada so if you want an object to be visible
> within a
>> subprogram it needs to be a parameter.
>
> thanks, I didn't know that
>
> And one more thing about the tutorial which You said should be
> shutdown.
>
> It's written there that there is no such thing as contructor.
> You'll have to define this function yourself.
>
> so if I want create an object you should write sth like this:
> object : testclass.rec1_Type := testclass.Create(10);
>
> how should Create body look like?
It is not possible for anyone to answer this question since we don't know
what you
are trying to accomplish. This sample code is too basic to really put any
"design" thought into but
for something that compiles.
begin 666 testclass.ads
M<&%C:V%G92!T97-T8VQA<W,@:7,-"@T*("!T>7!E(')E8S$@:7,@=&%G9V5D
M( T*(" @("!R96-O<F0@#0H@(" @(" @($9I96QD(#H@26YT96=E<CL@( T*
M(" @("!E;F0@<F5C;W)D.R -"@T*("!F=6YC=&EO;B!#<F5A=&4@* T*(" @
M(" @("!3(#H@:6X@(" @($EN=&5G97(@*2 -"B @("!R971U<FX@4F5C,3L@
M#0H-"B @<')O8V5D=7)E(%-E=" H#0H@(" @(" @(%(@.B!I;B!O=70@4F5C
M,3L@(" -"B @(" @(" @<R Z(" @(" @("!);G1E9V5R("D[( T*#0H@(&9U
M;F-T:6]N($=E=" H#0H@(" @(" @(%(@.B!I;B @(" @4F5C,2 I( T*(" @
G(')E='5R;B!);G1E9V5R.R -"@T*96YD('1E<W1C;&%S<SL-"@T*
`
end
begin 666 testclass.adb
M<&%C:V%G92!B;V1Y('1E<W1C;&%S<R!I<PT*#0H@("TM+2TM+2TM+2TM+0T*
M(" M+2!#<F5A=&4@+2T-"B @+2TM+2TM+2TM+2TM#0H-"B @9G5N8W1I;VX@
M0W)E871E#0H@(" H4R Z(&EN(" @("!);G1E9V5R*0T*(" @(')E='5R;B!2
M96,Q#0H@(&ES#0H@(&)E9VEN#0H@(" @<F5T=7)N(%)E8S$G*$9I96QD(#T^
M(%,I.PT*(" @("TM($%L<V\@;F]T92!W92!C;W5L9"!H879E('5S960@<F5T
M=7)N(%)E8S$G*$9I96QD(#T^(%,I.PT*(" @("TM(%1H:7,@=V]U;&0@8F4@
M;F5E9&5D(&EF('=E(&YE961E9"!T;R!H:6YT('1O('1H92!C;VUP:6QE<@T*
M(" @("TM(&5X86-T;'D@=VAA="!T>7!E('=E('=E<F4@=')Y:6YG('1O(&-R
M96%T92!H97)E+B!);B!T:&ES#0H@(" @+2T@8V%S92!T:&5R92!I<R!N;R!A
M;6)I9W5I='DN#0H@(&5N9"!#<F5A=&4[#0H-"B @+2TM+2TM+2TM#0H@("TM
M(%-E=" M+0T*(" M+2TM+2TM+2T-"@T*("!P<F]C961U<F4@4V5T#0H@(" H
M4B Z(&EN(&]U="!296,Q.PT*(" @(',@.B @(" @(" @26YT96=E<BD-"B @
M:7,-"B @8F5G:6X-"B @("!2+D9I96QD(#H](%,[#0H@(&5N9"!3970[#0H-
M"B @+2TM+2TM+2TM#0H@("TM($=E=" M+0T*(" M+2TM+2TM+2T-"@T*("!F
M=6YC=&EO;B!'970-"B @("A2(#H@:6X@(" @(%)E8S$I#0H@(" @<F5T=7)N
M($EN=&5G97(-"B @:7,-"B @8F5G:6X-"B @("!2971U<FX@4BY&:65L9#L-
?"B @96YD($=E=#L-"@T*96YD('1E<W1C;&%S<SL-"@``
`
end
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
2004-12-28 16:26 ` R
2004-12-28 17:01 ` Jeff C r e e.m
@ 2004-12-28 17:20 ` Martin Dowie
2004-12-28 17:36 ` R
1 sibling, 1 reply; 18+ messages in thread
From: Martin Dowie @ 2004-12-28 17:20 UTC (permalink / raw)
R wrote:
> rec1_Type is access to rec1 defined as tagged record with one variable
> 'field'.
Why are you using an access type?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
2004-12-28 17:01 ` Jeff C r e e.m
@ 2004-12-28 17:30 ` R
0 siblings, 0 replies; 18+ messages in thread
From: R @ 2004-12-28 17:30 UTC (permalink / raw)
Jeff C r e e.m wrote:
> It is not possible for anyone to answer this question since we don't
know
> what you
> are trying to accomplish.
I'm only trying to write a constructor.
Package testclass.
testclass.Create is meant to be my constructor
given main unit:
with Text_IO;
use Text_IO;
with testclass; -- include testclass package
procedure Main is
object : testclass.rec1_Type := testclass.Create(10);
begin
Put_Line(Integer'Image(testclass.Get(object)));
end Main;
testclass specyfication:
package testclass is
type rec1 is tagged private;
type rec1_Type is access rec1;
function Create(s: Integer) return rec1_Type;
function Set(this: rec1_Type; s: Integer) return Integer;
function Get(this: rec1_Type) return Integer;
private
type rec1 is tagged record
field: Integer;
end record;
end testclass;
testclass body:
package body testclass is
function Create(s: Integer) return rec1_Type is
begin
return testclass.rec1_Type(field=>s);
end Create;
function Set(this: rec1_Type; s: Integer) return Integer is
begin
this.field := s;
return this.field;
end Set;
function Get(this: rec1_Type) return Integer is
begin
return this.field;
end Get;
end testclass;
during compilation gnatmake points an error to:
return testclass.rec1_Type(field=>s);
$ gcc -c testclass.adb
testclass.adb:5:33: invalid prefix in call
gnatmake: "testclass.adb" compilation error
(the 5th line of testclass is return statement)
and I don't know how to write this constructor to return the access
type rec1_Type to rec1
hope it helps to help me ;-)
thanks in advance
best regards
R
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
2004-12-28 17:20 ` Martin Dowie
@ 2004-12-28 17:36 ` R
2004-12-28 19:47 ` Mark Lorenzen
` (4 more replies)
0 siblings, 5 replies; 18+ messages in thread
From: R @ 2004-12-28 17:36 UTC (permalink / raw)
because all OOP languages uses references to pass the objects as
parameters...
it will be needed in my program ;-)
best regrads R
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
2004-12-28 17:36 ` R
@ 2004-12-28 19:47 ` Mark Lorenzen
2004-12-28 19:48 ` Adrien Plisson
` (3 subsequent siblings)
4 siblings, 0 replies; 18+ messages in thread
From: Mark Lorenzen @ 2004-12-28 19:47 UTC (permalink / raw)
"R" <ruthless@poczta.onet.pl> writes:
> because all OOP languages uses references to pass the objects as
> parameters...
Exactly... but what does that have to do with access types? In Ada,
tagged types are automatically passed by reference, so you do not need
to fiddle around with pointers.
>
> it will be needed in my program ;-)
>
> best regrads R
- Mark Lorenzen
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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
` (2 subsequent siblings)
4 siblings, 0 replies; 18+ messages in thread
From: Adrien Plisson @ 2004-12-28 19:48 UTC (permalink / raw)
R wrote:
> because all OOP languages uses references to pass the objects as
> parameters...
>
> it will be needed in my program ;-)
oulalalalala... stop !!!
you seems more trying to hack Ada from C++/Java then really trying to
learn Ada.
my advice would be: buy some good book on ada or read one online (see
http://www.adapower.com/ section "books and tutorials" for references)
in ada you can pass parameters in 4 ways, by specifying a mode for
parameters: in, out, in out, access... you don't need an access type to
pass a parameter by reference, and you don't really need to worry about
passing by reference or other if you understand all the parameter modes.
as pointed in an earlier reply, an Ada package in equivalent to a C++
namespace. in C++ you define an object and all methods related to this
object in the same construction (namely a "class"). in Ada you define an
object by defining a tagged record and a set of procedures/functions
related to this tagged record. we group the tagged type and the methods
in a package for clarity (but we can define as many object/methods as we
want in the same package).
if your C++/Java class has 7 variable members ("fields"), then you
declare a tagged record containing 7 fields, not seven records... this
way you pass to your methods 1 parameter of the type of your tagged record.
btw, why are you trying to write this in Ada ? what is your goal ?
--
rien
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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 19:11 ` Martin Krischik
4 siblings, 0 replies; 18+ messages in thread
From: Georg Bauhaus @ 2004-12-28 19:58 UTC (permalink / raw)
R <ruthless@poczta.onet.pl> wrote:
: because all OOP languages uses references to pass the objects as
: parameters...
Ada may or may not use references depending on what kind of
value a subprogram parameter takes. But for tagged types, passing
values is always by reference, no need for an explicit pointer.
Object construction is slightly different in Ada, I think.
The function approach is one way to do it.
I liked this discussion:
http://www.cmis.brighton.ac.uk/staff/je/adacraft/ch14.htm
http://www.cmis.brighton.ac.uk/staff/je/adacraft/ch15.htm
You can also use a constructor procedure.
For example,
package Test_Class is
type Rec_1 is tagged
record
value: Integer;
end record;
procedure make(r: in out Rec_1; .......);
-- initialises all components of `r`
function get(r: Rec_1) return Integer;
procedure set(r: in out Rec_1; v: Integer);
end Test_Class;
Then somewhere else in your program,
declare
x: Rec_1;
begin
make(x, .......);
set(x, 5);
get(x);
end;
You could also have automatic initialisation using
default values for the object's components,
type Rec_1 is tagged record
value: Integer := default_value;
end record;
One more thing: Ada allows nesting blocks. So in many
cases, you can combine these techniques (and more).
Note that `default_value` can be a function.
-- Georg
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
2004-12-28 17:36 ` R
` (2 preceding siblings ...)
2004-12-28 19:58 ` Georg Bauhaus
@ 2004-12-28 21:17 ` Martin Dowie
2004-12-29 10:06 ` R
2004-12-29 19:11 ` Martin Krischik
4 siblings, 1 reply; 18+ messages in thread
From: Martin Dowie @ 2004-12-28 21:17 UTC (permalink / raw)
R wrote:
> because all OOP languages uses references to pass the objects as
> parameters...
Oh dear, no...
That's a might big assumption that 'all OOP languages' use references to
pass objects - that's how it's implemented but there is (usually) no
need in Ada for the programmer to get their hands dirty with such low
level details!
Tagged types are guaranteed to be passed by reference (the cost of the
tag alone makes this the obvious mechanism) and for other types the RM
either dictates how it is done or lets the compiler select what's best. :-)
Cheers
-- Martin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
2004-12-28 21:17 ` Martin Dowie
@ 2004-12-29 10:06 ` R
2004-12-29 12:33 ` Martin Dowie
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: R @ 2004-12-29 10:06 UTC (permalink / raw)
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
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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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
2 siblings, 0 replies; 18+ messages in thread
From: Martin Dowie @ 2004-12-29 12:33 UTC (permalink / raw)
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
Remove 'rec1_Type' - you really don't need it in all probability.
Cheers
-- Martin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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
2 siblings, 0 replies; 18+ messages in thread
From: Georg Bauhaus @ 2004-12-29 17:35 UTC (permalink / raw)
R <ruthless@poczta.onet.pl> wrote:
:
: 'in parameters cannot be modified inside function'(sth like this),
This helps you abide by a principle called query command separation:
: procedure Set(this: in out rec1; s: Integer) is
this is the command, and the Get function is the query.
the principle says that queries should never modify the object.
Commands do in general modify the object.
(You can still implement a query using a procedure that has
an out parameter.)
-- Georg
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
2004-12-28 17:36 ` R
` (3 preceding siblings ...)
2004-12-28 21:17 ` Martin Dowie
@ 2004-12-29 19:11 ` Martin Krischik
4 siblings, 0 replies; 18+ messages in thread
From: Martin Krischik @ 2004-12-29 19:11 UTC (permalink / raw)
R wrote:
> because all OOP languages uses references to pass the objects as
> parameters...
Ada automaticly uses references when they are needed. Read
Programming:Ada:OO#Primitive_operations
I mean the "note for C++ programmers".
Martin
--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
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
2004-12-30 12:14 ` Georg Bauhaus
2 siblings, 1 reply; 18+ messages in thread
From: Martin Krischik @ 2004-12-29 19:12 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: newbie - OOP in Ada Set and Get Methods
2004-12-29 19:12 ` Martin Krischik
@ 2004-12-30 12:14 ` Georg Bauhaus
0 siblings, 0 replies; 18+ messages in thread
From: Georg Bauhaus @ 2004-12-30 12:14 UTC (permalink / raw)
Martin Krischik <martin@krischik.com> wrote:
: R wrote:
:>
:> function Set(this: rec1; s: Integer) return Integer is
:>
:> 'in parameters cannot be modified inside function'(sth like this),
: Declare it "in out" if you want to make changes:
: function Set(this: in out rec1; s: Integer) return Integer is
I'm sure this is an oversight as functions cannot have in out
parameters, which is what the compiler said.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2004-12-30 12:14 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2004-12-30 12:14 ` Georg Bauhaus
2004-12-29 19:11 ` Martin Krischik
2004-12-28 13:39 ` Martin Krischik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox