Skip to content

Instantly share code, notes, and snippets.

@gannimo
Created January 16, 2018 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gannimo/769d95a404f756d218f7e157b94b0107 to your computer and use it in GitHub Desktop.
Save gannimo/769d95a404f756d218f7e157b94b0107 to your computer and use it in GitHub Desktop.
#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