comp.lang.ada
 help / color / mirror / Atom feed
From: ehsjony@ehs.ericsson.se (Jonas Nygren)
Subject: private types - controlled
Date: 1996/02/24
Date: 1996-02-24T00:00:00+00:00	[thread overview]
Message-ID: <4gmubj$4c4@erinews.ericsson.se> (raw)


I am trying to write support for shared objects
using reference counts and Ada.Finalization. The
shared object should be possible to extend while the
references should not.

Further I would like to have two version of references
which could be used to provide "different interfaces" to
the same object in an implementation, constant and
non-constant. I also want to be able to convert from
non-constant to constant but not the other way around.

So my code looks something like this:

with Ada.Finalization;
package Shared_Objects is
   type Shared_Object is tagged private;
   type Constant_Reference is private;
   type Reference is private;
   function To_Constant (R : Reference) return Constant_Reference;
private
   type Shared_Object is ....; 
   type Constant_Reference is new Ada.Finalization.Controlled with ...;
   type Reference is new Constant_Reference with null record;
end Shared_Objects;

The problem I get here is To_Constant. Gnat says:

  sharobje.ads:36:09: type must be declared abstract or "To_Constant" overridden

(line 36 being the line 'type Reference is new Constant_Reference with null record;')

I really don't understand what I should do to get this to work - what should I do 
to get this to work?

(I know about not having two controlling operands in a function interface but
at the point of declaration the types Reference and Constant_Reference are
private and hence, To_Constant is not a 'primitive operation' of any
tagged object)

/jonas





                 reply	other threads:[~1996-02-24  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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