Created
May 27, 2011 22:40
-
-
Save jl2/996339 to your computer and use it in GitHub Desktop.
Stupid operator overloading.
This file contains hidden or 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> | |
class WTF { | |
public: | |
WTF() : val(this) { } | |
WTF* operator->() { | |
std::cout << "hello "; | |
return this; | |
} | |
WTF &operator*() { | |
std::cout << "world"; | |
return *val; | |
} | |
WTF *operator,(const WTF &nv) { | |
std::cout << "\n"; | |
return val; | |
} | |
WTF *val; | |
}; | |
int main() { | |
WTF val, v2; | |
v2 = *(*val)->val, val, **(val->val),val; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment