Skip to content

Instantly share code, notes, and snippets.

@jl2
Created May 27, 2011 22:40
Show Gist options
  • Save jl2/996339 to your computer and use it in GitHub Desktop.
Save jl2/996339 to your computer and use it in GitHub Desktop.
Stupid operator overloading.
#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