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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bbc77d6e9a74feb5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-07 10:44:34 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.frii.net!newsfeed.frii.net!140.99.99.194.MISMATCH!newsfeed1.easynews.com!easynews.com!easynews!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: please help - access and inheritence References: <3fd27939$1@news.barak.net.il> In-Reply-To: <3fd27939$1@news.barak.net.il> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Sun, 07 Dec 2003 18:44:33 GMT NNTP-Posting-Host: 63.184.105.10 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.pas.earthlink.net 1070822673 63.184.105.10 (Sun, 07 Dec 2003 10:44:33 PST) NNTP-Posting-Date: Sun, 07 Dec 2003 10:44:33 PST Xref: archiver1.google.com comp.lang.ada:3205 Date: 2003-12-07T18:44:33+00:00 List-Id: Ratson Janiv wrote: > type Vehicleptr is access Jr.Vehicle.Vehicle'Class; > > type Vehiclesarr is array (1..Maxvehilces) of Vehicleptr; > > Vp1,Vp2,Vp3,Vp4,Vp5: aliased Jr.Vehicle.Private_Car.Vehicle_Private; > > Arr(1) := Vehicleptr(Vp1'access); -- failed, why? please ... You could be a bit more clear about what the problem is. Does "failed" mean a run-time problem or a compiler error? In either case, more information about the "failure" would be helpful. I note that Vehicleptr is not a general access type (access all ), but only allows access to values allocated on the heap (access ). Since Vp1'access does not designate a value allocated on the heap, it cannot be assigned to an object of type Vehicleptr. So if Arr (1) is a Vehicleptr [which seems likely, since you're trying to convert Vp1'access to Vehicleptr before assigning it to Arr (1)], the compiler should dissallow the assignment. If you define Vehicleptr as access all ..., and Arr is declared as Vehiclesarr, then you can write Arr (1) := Vp1'access; I guess saving the time to type an underline is more important than having code that is easy to read by using names such as Vehicle_Ptr. -- Jeff Carter "Every sperm is sacred." Monty Python's the Meaning of Life 55