int int."[]"(int bit) {
return ((*this)>>bit)&1;
}
int main() {
int x = 123;
if (x[0]) printf("%d is odd\n", x);
else printf("%d is even\n", x);
return 0;
}
operator[]
leaks abstraction by returning a reference or some crazy wrapper. Because Straustrup is a schizo.