Nov 10 2013

C++ Operator Functions Declaration

Published by at 11:08 pm under C Programming

A summary on how the different operator functions, in C++,  have to be declared

(replace @ by the operator in each case):

Expression Operator Member function Global function
@a        + – * & ! ~ ++ — A::[email protected]() [email protected](A)
[email protected]        ++ — A::[email protected](int) [email protected](A,int)
[email protected]        + – * / % ^ & | < > == !=

<= >= << >> && || ,

A::[email protected] (B) [email protected](A,B)
[email protected]        = += -= *= /= %= ^= &=

|= <<= >>= []

A::[email protected] (B)          –
a(b, c…)        () A::operator() (B, C…)          –
a->x        -> A::operator->()          –

PS: This is for my reference that I copied from cplusplus.com.

Comments Off on C++ Operator Functions Declaration

Comments are closed at this time.