comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <martin@krischik.com>
Subject: Re: Invalid operator name?
Date: Sat, 27 Nov 2004 20:21:50 +0100
Date: 2004-11-27T20:21:50+01:00	[thread overview]
Message-ID: <1371101.OKryl94uf8@linux1.krischik.com> (raw)
In-Reply-To: IR1qd.68030$Ro.2624307@news20.bellglobal.com

Sandro Magi wrote:

> When I try to define my own operator, I receive an "Invalid operator name"
> error during compilation. I've found references to operator overloading in
> reference materials, but no word whether new operators can be defined
> which leads me to believe that it's not possible.
> 
> Is it not possible to define new operators for a custom type? Can we only
> override the base operators?

Right, only the base operators can be overloaded.  See the following list:

http://en.wikibooks.org/wiki/Programming:Ada:Operators

However, Operators can be overloaded by Return type as well. See some of the
options used for "*", where the "*" operator my return a String,
Bounded_String or Unbounded_String depending on destination type.

http://en.wikibooks.org/wiki/Programming:Ada:Operators:*

But beware: to exotic uses for operators make the code more hard to read!

With Regards

Martin
-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



  parent reply	other threads:[~2004-11-27 19:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-27 16:23 Invalid operator name? Sandro Magi
2004-11-27 16:50 ` Stephen Leake
2004-11-27 19:21 ` Martin Krischik [this message]
2004-11-27 21:47 ` David C. Hoos, Sr.
replies disabled

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