comp.lang.ada
 help / color / mirror / Atom feed
From: Paul Chardon <paul.chardon@avions.aerospatiale.fr>
To: frebourg@cui.unige.ch
Subject: Re: + Operator
Date: 1996/12/10
Date: 1996-12-10T00:00:00+00:00	[thread overview]
Message-ID: <32AD1889.794BDF32@avions.aerospatiale.fr> (raw)
In-Reply-To: 58hf9j$bqe@uni2f.unige.ch


Hello Fabrice,

	Two notes about your short program. String is a unconstrained type and
therefore you can't use it to declare a variable, you must declare a
constrained type built with the string type; secondly you can use the
predefined unary "+" operator with any other type parameter.
Here is a little example that can help you.

procedure Test is

   subtype Str20 is String(1..20);

   type String_Ptr is access all Str20;

   function "+"(S : in Str20) return String_Ptr is
   begin
      return new Str20'(S);
   end "+";

   My_Str20    : Str20 := (others => ' ');   
   A_Str20_Ptr : String_Ptr;

begin
   A_Str20_Ptr:= + My_Str20 ;
end Test;

		Bye, Paul.




  reply	other threads:[~1996-12-10  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-09  0:00 + Operator FREBOURG Fabrice
1996-12-10  0:00 ` Paul Chardon [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-10-07  0:00 "<" operator dperez
1997-10-07  0:00 ` Matthew Heaney
1997-10-09  0:00   ` Mats Weber
replies disabled

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