comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Ada OOP question
Date: 12 Dec 2000 16:57:58 -0500
Date: 2000-12-12T22:09:45+00:00	[thread overview]
Message-ID: <ud7exe1zt.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 20001209101904.07653.00004016@ng-fy1.aol.com

hdhil@aol.com (HDhil) writes:

> Simple question re Ada OOP: Does Ada 95 allow
> the specification of public components? 

One solution is:

package My_Package is

    type My_Object_Private is private;

    type My_Object is record
        public_1 : foo;
        public_2 : bar;
        private_1 : My_Object_Private;
    end type;

private
    type My_Object_Private is record
        private_stuff : foo_bar;
    end record;
end My_Package;

Clients of this package can copy private_1, but can't examine inside
it. If copying is bad, use a limited private type.

-- 
-- Stephe



      parent reply	other threads:[~2000-12-12 21:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20001209101904.07653.00004016@ng-fy1.aol.com>
     [not found] ` <wvtY5.11680$Ei1.812152@bgtnsc05-news.ops.worldnet.att.net>
2000-12-11 21:52   ` Ada OOP question Randy Brukardt
     [not found] ` <kduY5.4872$M5.273278@news1.frmt1.sfba.home.com>
     [not found]   ` <3A32A182.54E3D857@acm.org>
     [not found]     ` <91382k$nq1$1@nnrp1.deja.com>
2000-12-12  5:14       ` Jeff Carter
2000-12-14 19:00         ` mark_lundquist
2000-12-14 23:05           ` Jeff Carter
2000-12-12 21:57 ` Stephen Leake [this message]
replies disabled

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