comp.lang.ada
 help / color / mirror / Atom feed
* 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

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