comp.lang.ada
 help / color / mirror / Atom feed
From: John English <je@brighton.ac.uk>
Subject: Re: Problem Eliminating constructors
Date: Fri, 17 Jan 2003 15:21:29 +0000
Date: 2003-01-17T15:20:08+00:00	[thread overview]
Message-ID: <3E281F79.A309AD5E@brighton.ac.uk> (raw)
In-Reply-To: 3e274cad$0$33929$bed64819@news.gradwell.net

Victor Porton wrote:
> 
> package A is
> 
>   type A_Type is tagged
>     record
>       X: Integer;
>     end;
> 
>   function Create(X: Integer) return A_Type; -- guess what is the body
> 
> end A;
> 
> Then I have
> 
> type B_Type is new A.A_Type with
>   record
>     Y: Integer;
>   end;
> 
> Compiler requires me to override Create as the return type changes.
> But it is meaningless as now I need Create with two parameters
> instead of one.
> 
> What to do?

Take Create out of package A and make it a child of the package:

  function A.Create(X: Integer) return A.A_Type is ...;

Now Create will no longer be a primitive operation of A_Type since
it isn't declared in the same package spec, but you can refer to
it in exactly the same way (except you would need "with A.Create"
to be able to call it).

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



  reply	other threads:[~2003-01-17 15:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-17  0:19 Problem Eliminating constructors Victor Porton
2003-01-17 15:21 ` John English [this message]
2003-01-17 21:10 ` Victor Porton
2003-01-18 15:19 ` Simon Wright
2003-01-20 11:39 ` Rodrigo García
2003-01-20 21:07 ` Victor Porton
2003-01-21  9:44   ` Dmitry A. Kazakov
2003-01-21 19:01     ` Martin Krischik
2003-01-21 11:43   ` Rodrigo García
2003-01-21 15:03   ` Stephen Leake
2003-01-21 13:09 ` Victor Porton
2003-01-22 15:26   ` Rodrigo García
2003-01-21 18:38 ` Victor Porton
2003-01-23 17:08   ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2003-01-17  6:54 Grein, Christoph
replies disabled

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