From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9a4a0b8e5206a866,start X-Google-Attributes: gid103376,public From: "Paul S. Heidmann" Subject: Conversion of Access Types Question Date: 1999/01/14 Message-ID: <369DFFFC.A160D47C@neta.com>#1/1 X-Deja-AN: 432558352 Content-Transfer-Encoding: 7bit Sender: nntp@news.boeing.com (Boeing NNTP News Access) X-Nntp-Posting-Host: pe72180.mdhc.mdc.com Content-Type: text/plain; charset=us-ascii Organization: The Boeing Company Mime-Version: 1.0 Reply-To: psh@neta.com Newsgroups: comp.lang.ada Date: 1999-01-14T00:00:00+00:00 List-Id: 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