comp.lang.ada
 help / color / mirror / Atom feed
From: wdl39!mab@ford-wdl1.arpa  (Mark A Biggar)
Subject: Re: Can I overload ":="?
Date: 14 Oct 92 20:27:30 GMT	[thread overview]
Message-ID: <1992Oct14.202730.8562@wdl.loral.com> (raw)

In article <mmaccorm.35@fox.nstn.ns.ca> mmaccorm@fox.nstn.ns.ca (Mike Mac Corma
ck) writes:
>Couldn't you use the type name as type conversion operator?  If you had a 
>type "Complex", and wanted to convert it to a real, couldn't you 
>overload "real" as follows:
>	function real(c :Complex) return real;
>and then use the statement
>	r := real(c);
>to convert it to a real?

This doesn't work because overload resolution only works for subprograms.
The above declaration completely hides the type name "real", it doesn't
overload it.  The above declaration may even be illegal because the function
name "real" arleady hides the type name by the time the complier gets to the 
function return type.  Besides the above functions is better called "real_part"
to distinguish it form the complementary function "imaginary_part", unless
you wanted the modulas in which case overloading "abs" makes more sense.

--
Mark Biggar
mab@wdl1.wdl.loral.com

             reply	other threads:[~1992-10-14 20:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-10-14 20:27 Mark A Biggar [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-10-14 16:22 Can I overload ":="? dog.ee.lbl.gov!hellgate.utah.edu!caen!destroyer!cs.ubc.ca!utcsri!torn!csd.unb.ca!morgan.ucs.mun.ca!nstn.ns.ca!mmaccorm
1992-10-13 12:07 cis.ohio-state.edu!news.sei.cmu.edu!firth
1992-10-13  4:08 Can I overload ": ="? Michael Feldman
replies disabled

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