Re: Extend Record in Spec and Body
- From: "Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx>
- Date: Tue, 17 Oct 2006 09:30:39 +0200
On 16 Oct 2006 08:30:46 -0700, richard.charts@xxxxxxxxx wrote:
Is it possible to extend a record twice in a package?
Yes, but not in the body and each extension would produce a new type.
I'm building a component now that will be mostly reusable. There are a
couple packages that are the same, but for one piece the differences
require different code. However, with the way it is designed, it seems
I could make the package specs the same and only alter the bodies.
I would like to try to hide part of the extended record from the
specification without having to change the operation declarations.
You cannot do it in the body and you cannot do it so that both extensions
were looked as one type. But you can make one extension public and another
private:
type Transient_Object is abstract new HigherPackage.object with record
<public things>
end record;
type Object is new Transient_Object with private;
private
type Object is new Transient_Object with record
<private things>
end record;
Well, if the public things are read-only you could expose them through
getters using the prefix interface (new in Ada 2005), and then move
everything into private.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.
- Follow-Ups:
- Re: Extend Record in Spec and Body
- From: Simon Wright
- Re: Extend Record in Spec and Body
- References:
- Extend Record in Spec and Body
- From: richard.charts@xxxxxxxxx
- Extend Record in Spec and Body
- Prev by Date: Re: Extend Record in Spec and Body
- Next by Date: Re: Libre site down, again
- Previous by thread: Re: Extend Record in Spec and Body
- Next by thread: Re: Extend Record in Spec and Body
- Index(es):
Relevant Pages
|
|