comp.lang.ada
 help / color / mirror / Atom feed
From: "R" <ruthless@poczta.onet.pl>
Subject: newbie - OOP in Ada Set and Get Methods
Date: 28 Dec 2004 04:41:13 -0800
Date: 2004-12-28T04:41:13-08:00	[thread overview]
Message-ID: <1104237673.373489.128290@z14g2000cwz.googlegroups.com> (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;




             reply	other threads:[~2004-12-28 12:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-28 12:41 R [this message]
2004-12-28 13:36 ` newbie - OOP in Ada Set and Get Methods 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
replies disabled

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