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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9fd97969641aa8c6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!proxad.net!news.cs.univ-paris8.fr!newsfeed.vmunix.org!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: how can i allocate an objekt with initialization??? Date: Mon, 06 Dec 2004 09:52:04 +0100 Organization: None Message-ID: <3459883.9H2ke8dEzz@linux1.krischik.com> References: Reply-To: martin@krischik.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8Bit X-Trace: news.t-online.com 1102324443 02 5046 vetMX47l7av6So01 041206 09:14:03 X-Complaints-To: usenet-abuse@t-online.de X-ID: ZqrnroZvge-pJmCf2fwSado4oLNmc5yG6QjDkfIcddBtyz7eVMVacV User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:6793 Date: 2004-12-06T09:52:04+01:00 List-Id: Thomas Bruns wrote: > TEST : FATHER_CLASS_PTR; > > begin > TEST:= new CHILD_CLASS'( INT=>1); -- i will initialze the objekt here,but Since you are initializing an element form the parent class you need to initialize the child as well: TEST:= new CHILD_CLASS'( INT1 =>1 INT2 =>1); only the other way round you can shortcut: TEST:= new CHILD_CLASS'( FATHER_CLASS WITH INT2 =>1); And the standart question for beginners: Are you shure you need a pointer? Unlike C/C++/Java Ada allows for: TEST : FATHER_CLASS'Class :=�CHILD_CLASS'( INT1 =>1 INT2 =>1); You can use inheritance in Ada without using pointers! FATHER_CLASS'Class can be used just like a String - you can pass it around as parameter, return it from a function, store it in a record. There are collection libraries where you can store them. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com