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,1e36228aae0595da X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!newsfeed-fusi2.netcologne.de!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Access to function returning class-wide type Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Thu, 21 Aug 2008 13:02:40 +0200 Message-ID: NNTP-Posting-Date: 21 Aug 2008 13:02:43 CEST NNTP-Posting-Host: 1dcbcacc.newsspool1.arcor-online.net X-Trace: DXC=;ogaK>@J^be[F<50eo:0knic==]BZ:afn4Fo<]lROoRa4nDHegD_]Re9ak]5k;\@?fDNcfSJ;bb[eIRnRBaCd On Thu, 21 Aug 2008 12:13:10 +0200, Pawe� 'Nivertius' P�azie�ski wrote: > What I need is a access type to 'constructor' of an derivate of abstract > object. > As I presented, there is a workaround, but that's not the 'right' way to do > it. I really want to do it without some tricky wrapping. > How do I define The_Access_Type to do what I want? See Ada.Tags.Generic_Dispatching_Constructor. It gives you a function constructing an object from the type tag, the parameters (Natural in your case) using the function you want (Proc). It goes as follows: with Ada.Tags.Generic_Dispatching_Constructor; package A is type Abstracted is abstract tagged null record; function Proc (N : not null access Natural) return Abstracted is abstract; function Constructor is new Ada.Tags.Generic_Dispatching_Constructor (Abstracted, Natural, Proc); end A; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de