comp.lang.ada
 help / color / mirror / Atom feed
From: Adrien Plisson <aplisson-news@stochastique.net>
Subject: Re: newbie - OOP in Ada Set and Get Methods
Date: Tue, 28 Dec 2004 20:48:17 +0100
Date: 2004-12-28T20:48:17+01:00	[thread overview]
Message-ID: <41d1b804$0$301$ba620e4c@news.skynet.be> (raw)
In-Reply-To: <1104255406.015130.138150@z14g2000cwz.googlegroups.com>

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




  parent reply	other threads:[~2004-12-28 19:48 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 [this message]
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