Created
December 22, 2010 18:11
-
-
Save jl2/751862 to your computer and use it in GitHub Desktop.
Funny C++ hello world program
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; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment