comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Type extension and discriminants
Date: Sun, 12 Oct 2014 09:27:45 -0700 (PDT)
Date: 2014-10-12T09:27:45-07:00	[thread overview]
Message-ID: <64f0b8de-72d7-49d8-ac03-725819b1057e@googlegroups.com> (raw)
In-Reply-To: <aa0678d5-f777-4a52-952f-dc9a2f16ed74@googlegroups.com>

On Saturday, October 11, 2014 7:45:56 PM UTC+2, sbelm...@gmail.com wrote:
> package A is
>    type T1 (<>) is tagged limited private;
>    function T1_Ctor return T1;
> private
>    type T1 (I_Ptr : access Integer) is tagged limited null record;
> end A;
> 
> package body A is
>    function T1_Ctor return T1 is
>    begin
>       return (I_Ptr => null);
>    end T1_Ctor;
> end A;
> 
> with A;
> package B is
>    type T2 (<>) is new A.T1 with private;

I guess the following function is implicitly declared here and must be overridden because it's abstract:
     function T1_Ctor return T2;

>    function T2_Ctor return T2;
> private
>   type T2 is new A.T1 with null record;
> end B;
>
> package body B is
>    function T2_Ctor return T2 is
>    begin
>       return T2'(A.T1_Ctor with null record);
>    end T2_Ctor;
> end B;

      parent reply	other threads:[~2014-10-12 16:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10 20:55 Type extension and discriminants sbelmont700
2014-10-10 22:34 ` Randy Brukardt
2014-10-11 17:45   ` sbelmont700
2014-10-11 18:44     ` Simon Wright
2014-10-11 18:52     ` Dmitry A. Kazakov
2014-10-11 21:09       ` sbelmont700
2014-10-12  6:51         ` Dmitry A. Kazakov
2014-10-12 16:27     ` AdaMagica [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox