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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4651b0d82680c5d2,start X-Google-Attributes: gid103376,public From: abacon@cps.udayton.edu (Adam C. Bacon) Subject: Polymorphism/Inheritence Date: 1997/02/26 Message-ID: <5f0pcc$5b9@news.cps.udayton.edu>#1/1 X-Deja-AN: 221520747 Organization: The University of Dayton Computer Science Dept., Dayton, OH Newsgroups: comp.lang.ada Date: 1997-02-26T00:00:00+00:00 List-Id: I am a Computer Science student at the University of Dayton using the GNAT Compiler for Ada 95. One of our recent problems was to write a simple set of packages and a driver program to illustrate the principles of inheritence and polymorphism. In doing the assignment, I discovered a difference (which I believe may be a bug) between version 2.06S of the GNAT compiler (for DOS, using DJGPP) and versions 3.04 and higher. In my parent package specification, I have the parent type in the hierarchy declared as a tagged private type: type Vehicle is tagged private; I also have a pointer declared as follows: type Vehicle_Pointer is access Vehicle'Class; In a child package specification, I have a private type declared as follows: type Car is new Vehicle with private; I have two local variables defined in the child package body as follows: Pointer : Vehicle_Pointer; Temp_Car : Car; The problem that I have arises when I make an assignment in a function defined in the child package body. The assignment occurs in a Create procedure, which is as follows: Pointer.all := Temp_Car; Prior to this assignment, I make the following: Pointer := new Car; The error which I receive from the compiler is the following: Pointer.all := Temp_Car; | dynamically tagged expression required After discussing this problem with my professor and with other students, we are unable to find out why this occurs, especially since it does not occur in GNAT version 2.06S, only in versions 3.04 and higher. If anyone else has experienced this problem, I would be interested in discussing any possible solutions you have found. Thanks, Adam Bacon