Skip to content

Instantly share code, notes, and snippets.

@jl2
Created December 22, 2010 18:11
Show Gist options
  • Save jl2/751862 to your computer and use it in GitHub Desktop.
Save jl2/751862 to your computer and use it in GitHub Desktop.
Funny C++ hello world program
#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