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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9fd97969641aa8c6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: how can i allocate an objekt with initialization??? Date: 05 Dec 2004 17:51:25 -0500 Organization: Cuivre, Argent, Or Message-ID: References: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1102287125 7688 212.85.156.195 (5 Dec 2004 22:52:05 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Sun, 5 Dec 2004 22:52:05 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:6790 Date: 2004-12-05T17:51:25-05:00 Thomas Bruns writes: > Hello > > i have a problem, with initialzie objekt with ada... > > i want to do a new, to allocate the objekt... Here's a version of your code that compiles (except it is missing a package body): with ADA.FINALIZATION; use ADA.FINALIZATION; package class_test_package is type FATHER_CLASS is new CONTROLLED with record INT1 : INTEGER; end record; type FATHER_CLASS_PTR is access all FATHER_CLASS'Class; function GETINT1 return INTEGER is abstract; end class_test_package; with class_test_package; use class_test_package; package class_test_package_ableitung is type CHILD_CLASS is new FATHER_CLASS with private; type CHILD_CLASS_PTR is access CHILD_CLASS'CLASS; function Factory (Int1, Int2 : in Integer) return Child_Class_Ptr; private procedure Initialize (OBJECT : in out Child_CLASS); procedure Finalize (OBJECT : in out CHILD_CLASS); procedure ADJUST (OBJECT : in out CHILD_CLASS); type CHILD_CLASS is new FATHER_CLASS with record INT2 : INTEGER; end record; end class_test_package_ableitung; with Class_Test_Package; with Class_Test_Package_Ableitung; procedure Main is TEST : Class_Test_Package.FATHER_CLASS_PTR; begin TEST := Class_Test_Package.FATHER_CLASS_PTR (Class_Test_Package_Ableitung.Factory (INT1 => 1, Int2 => 2)); end Main; Your problem was that Child_Class is a private type; you cannot create an aggregate for it. The body of Factory can use an aggregate. Hope this helps. -- -- Stephe