comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeff C r e e.m" <jcreem@yahoo.com>
Subject: Re: newbie - OOP in Ada Set and Get Methods
Date: Tue, 28 Dec 2004 17:01:27 GMT
Date: 2004-12-28T17:01:27+00:00	[thread overview]
Message-ID: <HjgAd.817215$8_6.265650@attbi_s04> (raw)
In-Reply-To: 1104251213.061878.187430@f14g2000cwb.googlegroups.com


"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




  reply	other threads:[~2004-12-28 17:01 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 [this message]
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
replies disabled

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