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,7508aa0d80b8bf66 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Inheritance and Polymorphism in Ada !! Date: 1999/10/18 Message-ID: #1/1 X-Deja-AN: 537563582 Sender: bobduff@world.std.com (Robert A Duff) References: <7u64k3$l1d$1@hiline.shinbiro.com> <3806DC34.1513E8B1@frqnet.de> <38077a53_4@news1.prserv.net> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1999-10-18T00:00:00+00:00 List-Id: "Matthew Heaney" writes: > Yes, it's true that dynamic memory allocation isn't allowed, but Ada was > designed to that you don't need dynamic memory allocation. > > There was no reason for you to put the object on the heap. You could > have said just as easily: > > Object : Type_A'Class := Type_B'(1, 2); > > No heap required. True in this case, but I think it's fair to say that if you're doing OOP, you will *usually* need to put some objects in the heap. The above trick only works when you know the tag you want a the right time, and you don't want to change the tag (which you can simulate by deallocating and reallocating in the heap), and when you don't have heterogeneous data structures (eg you're not allowed to make an array of a class-wide type). - Bob -- Change robert to bob to get my real email address. Sorry.