Created
January 16, 2018 14:40
-
-
Save gannimo/ff204ea5185431490b0f222be528c325 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