Mail Archives: djgpp/1997/08/13/14:27:42
From: | Erik Max Francis <max AT alcyone DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: C++ overloaded operators and operator preceedence
|
Date: | Tue, 12 Aug 1997 23:57:19 -0700
|
Organization: | Alcyone Systems
|
Lines: | 26
|
Message-ID: | <33F15ACF.571ECB09@alcyone.com>
|
References: | <33EDDE0A DOT 2014C272 AT execulink DOT com>
|
NNTP-Posting-Host: | newton.alcyone.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Jeff Weeks wrote:
> Alright, does anybody know if operator preceedence (or, order of
> operations) is preserved when you overload an operator in C++?
>
> For instance, if you overload the * operator, will it still be processed
> along side division in the operator preceedence? Or will overloaded
> operators just be interpreted from left to right?
Correct. The number of arguments (though the types may differ, even
within one operator) are unchangeable, as well as the operator precedence
for all the overloadable operators.
> In simpler terms will 3 + 2 * 2 equal 7 or 10 if both + and * are
> overloaded?
Basically, yes, provided you overloaded them with some sort of trivial
case.
--
Erik Max Francis, &tSftDotIotE / email / mailto:max AT alcyone DOT com
Alcyone Systems / web / http://www.alcyone.com/max/
San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W
\
"Love is not love which alters / when it alteration finds."
/ William Shakespeare, _Sonnets_, 116
- Raw text -