comp.lang.ada
 help / color / mirror / Atom feed
* Conversion of Access Types Question
@ 1999-01-14  0:00 Paul S. Heidmann
  1999-01-14  0:00 ` David C. Hoos, Sr.
  0 siblings, 1 reply; 14+ messages in thread
From: Paul S. Heidmann @ 1999-01-14  0:00 UTC (permalink / raw)


Greetings fellow Ada lovers!

I'm an experienced Ada83 programmer that is learning to use Ada95.
Things are going very well, but I don't understand the problems
that I'm having converting access types that point to variables of
class wide types.  Consider the following piece of code:

=======================================

procedure Types is

   type T1 is tagged
      record
         I : Integer;
      end record;
   type A_T1 is access all T1'Class;

   type T2 is new T1 with
      record
         I2 : Integer;
      end record;
   type A_T2_Classwide is access all T2'Class;
   type A_T2 is access T2;

   Thing1 : A_T1;
   Thing2 : A_T2_Classwide;
   Thing3 : A_T2;

begin
   Thing1 := new T2;
   Thing2 := A_T2_Classwide (Thing1);
   Thing3 := A_T2 (Thing1);  -- illegal, types are not convertable.
end Types;

=======================================

My question is, why is the last line an illegal conversion, but the
second to last line not?

Thanks!

Paul Heidmann




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

end of thread, other threads:[~1999-01-28  0:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-14  0:00 Conversion of Access Types Question Paul S. Heidmann
1999-01-14  0:00 ` David C. Hoos, Sr.
1999-01-14  0:00   ` Paul S. Heidmann
1999-01-14  0:00     ` Tucker Taft
1999-01-14  0:00     ` David C. Hoos, Sr.
1999-01-15  0:00   ` dewar
1999-01-20  0:00     ` Robert A Duff
1999-01-20  0:00       ` Matthew Heaney
1999-01-20  0:00         ` Tucker Taft
1999-01-21  0:00         ` robert_dewar
1999-01-27  0:00         ` Nick Roberts
1999-01-28  0:00           ` robert_dewar
1999-01-21  0:00       ` robert_dewar
1999-01-21  0:00         ` Tom Moran

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