comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: overloading "=" (equal sign)
Date: 1999/06/08
Date: 1999-06-08T00:00:00+00:00	[thread overview]
Message-ID: <m31zfngt6u.fsf@mheaney.ni.net> (raw)
In-Reply-To: 7jhq7l$66c$1@bgtnsc03.worldnet.att.net

On Mon, 7 Jun 1999 21:13:21 -0400, "John" <j.gonzale@worldnet.att.net> wrote:

> It looks like the "=" sign when overloaded, it asks for limited type
> parameters only.

I'm not sure what you mean by this, becuase the equality operator does
NOT have to take limited types as parameters.  Perhaps if you send some
code, then we can determine what the problem is.

> So, I declare:
>  type 'variable' is limited private;

I don't know what you mean by this, since this is not a legal Ada
declaration.

>  then,
> private
>     type 'variable' is new u32.un_integer;
> 
> Is there any way to pass non-limited parameters to my function ?

If you mean, Can an equality operator take non-limited types as
parameters, the answer is yes.

> Or, is there any way to get rid of the private stuff ?

Yes:


package P is

  type My_Integer is new Interfaces.Unsigned_32;

-- type My_Integer is mod 2**32;
-- (alternate declaration)

  function "=" (L, R : My_Integer) return Boolean;

end P;

package body P is

  function "=" (L, R : My_Integer) return Boolean is
  begin
    <impl here>
  end;

end P;



But I really don't know if this is what you want to do.





  reply	other threads:[~1999-06-08  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-07  0:00 overloading "=" (equal sign) John
1999-06-08  0:00 ` Matthew Heaney [this message]
1999-06-08  0:00   ` Keith Thompson
1999-06-09  0:00     ` John
1999-06-10  0:00       ` Robert Dewar
1999-06-10  0:00       ` Bryce Bardin
replies disabled

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