cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Create custom operators
Create custom operators
Mar 10, 2010 at 5:36pm UTC
ToniAz
(351)
Hello everyone,
Is it possible to create our custom operators?? For example x! (factorial) where x is of int class ?
Thanks.
Mar 10, 2010 at 5:52pm UTC
orejano
(8)
You can't create new operators that work on normal types (int bool etc), but you can overload the existing +, - etc operators.
http://www.cplusplus.com/doc/tutorial/classes2.html
You can create new operators for your custom classes however.
Also check this link:
http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/cplr318.htm
Last edited on
Mar 10, 2010 at 5:53pm UTC
Mar 10, 2010 at 5:52pm UTC
Duthomhas
(13206)
No.
(Sorry)
[edit] too slow...[/edit]
Last edited on
Mar 10, 2010 at 5:52pm UTC
Mar 10, 2010 at 6:23pm UTC
ToniAz
(351)
thanks orejano i've seen the 1st link before, but i just looked at the second and im not familiar with the syntax so i doubt i can fully understand the code (more like get 50% of it).
Anyway thank u both...
Topic archived. No new replies allowed.