From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ccb21d128bf5f2ae,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: "R" Newsgroups: comp.lang.ada Subject: newbie - OOP in Ada Set and Get Methods Date: 28 Dec 2004 04:41:13 -0800 Organization: http://groups.google.com Message-ID: <1104237673.373489.128290@z14g2000cwz.googlegroups.com> NNTP-Posting-Host: 83.238.46.94 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1104237677 15338 127.0.0.1 (28 Dec 2004 12:41:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 28 Dec 2004 12:41:17 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=83.238.46.94; posting-account=vW-V7A0AAADVHjc0FRFWzwhUHLUBcq4I Xref: g2news1.google.com comp.lang.ada:7246 Date: 2004-12-28T04:41:13-08:00 List-Id: 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;