comp.lang.ada
 help / color / mirror / Atom feed
* Limiting inheritance
@ 2000-07-27  0:00 reason67
  2000-07-27  0:00 ` Matthew J Heaney
  2000-07-29  0:00 ` Robert I. Eachus
  0 siblings, 2 replies; 4+ messages in thread
From: reason67 @ 2000-07-27  0:00 UTC (permalink / 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.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-07-29  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-27  0:00 Limiting inheritance reason67
2000-07-27  0:00 ` Matthew J Heaney
2000-07-28  0:00   ` Ehud Lamm
2000-07-29  0:00 ` Robert I. Eachus

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