-
-
Save gannimo/769d95a404f756d218f7e157b94b0107 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Fun { | |
public: | |
int loc; | |
Fun(int val) { loc = val; } | |
inline bool operator==(const Fun& rhs) { | |
loc += 1; | |
return loc == rhs.loc; | |
} | |
inline bool operator==(int rhs) { | |
loc += 1; | |
return loc == rhs; | |
} | |
}; | |
int main(int argc, char *argv[]) { | |
Fun test(0); | |
if (test == 1 && test == 2 && test == 3) { | |
cout << "Overloading operators is fun." << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment