From: "James S. Rogers" <jimmaureenrogers@worldnet.att.net>
Subject: Re: Dispatching problem.
Date: Thu, 06 Feb 2003 15:33:45 GMT
Date: 2003-02-06T15:33:45+00:00 [thread overview]
Message-ID: <tfv0a.23446$rq4.1770947@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: f74cb448.0302060604.e808c22@posting.google.com
"Petter Fryklund" <petter.fryklund.konsult@dynamics.saab.se> wrote in
message news:f74cb448.0302060604.e808c22@posting.google.com...
> We have the following:
>
> package A is
> type Msg;
> type Msg_Ptr is access all Msg'Class;
> type Msg is abstract tagged null record;
> ... other declarations
>
> type M1 is new Msg with ....
> type M1_Ptr is access all M1;
> type M2 is new Msg with ....
> type M2_Ptr is access all M2;
> ... other declarations
>
> function X (Param : Integer) return Msg_Ptr;
> end A;
>
> with A;
> package B is
> type Msg is abstract new A.Msg with null record;
> type Msg_Ptr is access all Msg;
> type B1 is new A.M1 with null record;
> type B1_Ptr is access all B1;
> type B2 is new A.M1 with null record;
> type B2_Ptr is access all B2;
>
> procedure Y (MP : access B1);
> procedure Y (MP : access B2);
> end B;
>
> with A;
> with B;
> procedure Main is
>
> X : A.Msg_Ptr;
> Y : A.Msg_Ptr;
> begin
> X := A.X (1); -- Building a A.M1
> Y := A.X (2); -- Building a A.M2
> B.Y (B.Msg_Ptr (X)); -- causes Constraint_Error Tag Check Failed to be
raised.
> end Main;
>
> How can we dispatch in package B?
You seem to have your inheritence concepts inverted here.
Every B.B1 is a member of the class rooted at A.Msg. Not every
A.Msg is a member of B.B1. For instance, A.M1 is not a B.B1.
Jim Rogers
next prev parent reply other threads:[~2003-02-06 15:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-06 14:04 Dispatching problem Petter Fryklund
2003-02-06 15:33 ` James S. Rogers [this message]
2003-02-07 7:35 ` Petter Fryklund
2003-02-07 9:01 ` Dmitry A. Kazakov
2003-02-07 14:55 ` Petter Fryklund
2003-02-10 9:12 ` Dmitry A. Kazakov
2003-02-11 8:31 ` Petter Fryklund
-- strict thread matches above, loose matches on Subject: below --
2008-01-15 18:55 petter_fryklund
2008-01-15 19:49 ` Dmitry A. Kazakov
2008-01-15 20:01 ` petter_fryklund
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox