comp.lang.ada
 help / color / mirror / Atom feed
From: reason67@my-deja.com
Subject: Limiting inheritance
Date: 2000/07/27
Date: 2000-07-27T00:00:00+00:00	[thread overview]
Message-ID: <8lq7tj$5rt$1@nnrp1.deja.com> (raw)

Let's day I have the types specified as follows:

package Patch is

   type Patch_Type is (red, orange, yellow, green, blue, violet);

   subtype Base_Patch_Type is Patch_Type Red .. Green;

    type Object is tagged private;

    ...

    procedure Set_Patch_Kind (To : in Base_Patch_Type; In_Object : in
Object);

...

private

   type Object is tagged
       record
...
          Kind : Patch_Type;
...
       end record;

end Patch;

package Patch.Fancy is

    subtype Fancy_Patch_Kind is Patch_Kind Blue .. Violet;

    type Object is new Patch.Object with tagged private;

...

    procedure Set_Patch_Kind (To : in Fancy_Patch_Type; In_Object : in
Object);

...

private

   type Object is new Patch.Object with
       record
...

       end record;

end Patch.Fancy;

OK. What I am trying to do is enforce the Kind to the subtype that makes
sense in the parent or the child. I can not do what I show above because
it does not compile (Dispatching operation is not subtype conformant)

I can make the procedres 2 different names but if I go that route, I
want to NOT inherit the procedure from the parent to the child. Is there
a way to do this?
---
Jeffrey


Sent via Deja.com http://www.deja.com/
Before you buy.




             reply	other threads:[~2000-07-27  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-27  0:00 reason67 [this message]
2000-07-27  0:00 ` Limiting inheritance Matthew J Heaney
2000-07-28  0:00   ` Ehud Lamm
2000-07-29  0:00 ` Robert I. Eachus
replies disabled

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