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.7 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c71d0b53277efb27,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.25.194 with SMTP id e2mr1811373pbg.7.1320719344551; Mon, 07 Nov 2011 18:29:04 -0800 (PST) Path: h5ni10837pba.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: "Rego, P." Newsgroups: comp.lang.ada Subject: Another question on class constructor Date: Mon, 7 Nov 2011 18:27:26 -0800 (PST) Organization: http://groups.google.com Message-ID: <19338900.553.1320719246503.JavaMail.geo-discussion-forums@yqpp12> Reply-To: comp.lang.ada@googlegroups.com NNTP-Posting-Host: 200.148.121.196 Mime-Version: 1.0 X-Trace: posting.google.com 1320719344 14302 127.0.0.1 (8 Nov 2011 02:29:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 8 Nov 2011 02:29:04 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=200.148.121.196; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu User-Agent: G2/1.0 X-Google-Web-Client: true Xref: news1.google.com comp.lang.ada:18850 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-11-07T18:27:26-08:00 List-Id: I have a class defined as: type Test_Class is tagged limited record Info : Integer; Value : Float; Primary : Primary_Task (Test_Class'Access); end record; I need build a one-step constructor for my class in the form function Construct (T : access Test_Class) return Test_Class_Ptr is begin return new Test_Class'(Info => T.Info + 1, Value => 0.0, Primary => [WHAT I WANNA KNOW]); end Construct; Currently my code is: -- test_pkg.ads package Test_Pkg is type Test_Class; type Test_Class_Ptr is access all Test_Class; task type Primary_Task (This_Test : access Test_Class) is pragma Storage_Size (1000); end Primary_Task; type Test_Class is tagged limited record Info : Integer; Value : Float; Primary : Primary_Task (Test_Class'Access); end record; function Construct (T : access Test_Class) return Test_Class_Ptr; end Test_Pkg; -- test_pkg.adb with Text_IO; use Text_IO; package body Test_Pkg is [...] function Construct (T : access Test_Class) return Test_Class_Ptr is T_Ptr : constant Test_Class_Ptr := new Test_Class; begin T_Ptr.Info := T.Info + 1; T_Ptr.Value := 0.0; return T_Ptr; end Construct; end Test_Pkg; So, how can I code it? What should I put in Primary => [...] code? Should I change the definition of Primary : Primary_Task (Test_Class'Access); in Test_Class definition? Thanks.