From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Can't hide parts of ADTs in private children
Date: 1998/11/16
Date: 1998-11-16T00:00:00+00:00 [thread overview]
Message-ID: <m3zp9smw74.fsf@mheaney.ni.net> (raw)
In-Reply-To: 364683EB.41C6@syd.csa.com.au
David Bowerman <davidb@syd.csa.com.au> writes:
> I am implementing an Abstract Data Type (Class) in a package. The code
> goes something like this:
[snip]
> Can anyone suggest another way of doing it.
Do this:
package Class_X_Package is
type Class_X is private;
type Class_X_Ptr is access Class_X;
... operations on objects of type X
private
type Type_A is ...;
type Type_B is ...;
type Class_X is
record
Component_A : Type_A;
Component_B : Type_B;
...
end record;
end Class_X_Package;
If you prefer, you can declare nested packages
private
package A_Types is
type Type_A is private;
...
end A_Types;
use A_Types;
package B_Types is
type Type_B is private;
...
end B_Types;
use B_Types;
type Class_X is
record
Comp_A : Type_A;
Comp_B : Type_B;
...
end record;
end Class_X_Package;
prev parent reply other threads:[~1998-11-16 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-09 0:00 Can't hide parts of ADTs in private children David Bowerman
1998-11-09 0:00 ` Stephen Leake
1998-11-10 0:00 ` Dale Stanbrough
1998-11-16 0:00 ` Matthew Heaney [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