how can i define an operator ?
i have do define the prod operator with 2 predicates (lq (<=) and neg (!=))
how can i do that ?
if it is a stupid question sorry!
Printable View
how can i define an operator ?
i have do define the prod operator with 2 predicates (lq (<=) and neg (!=))
how can i do that ?
if it is a stupid question sorry!
if im understanding you correctly, you want to define how a
cetain operator will act on two variables of some form. This is
called operator overloading and isn't contained in c, but it is in
c++. I may be misinterpretting you though.
yes. how can i do that in c++ ? sorry but the ambiguesness of the question but the one who asked it was a little ambigous
If you are using C++, wouldn't that be better asked in the C++ forum?Quote:
Originally Posted by spank
Moved to C++
http://www.cplusplus.com/doc/tutorial/classes2.html
If you don't like that one, just google for "Operator Overloading' - there's a lot of 'em
Just to clarify for you though. There is no way to "define" an operator. This meaning to say you're creating an operator that doesn't exist. C++ has a set list of operators which you can not change the number of arguments of or the precedence of. Overloading operators is creating more functionality for C++ defined operators to suit the needs of user defined datatypes.