user

Pete's Log: procrastinating

Entry #885, Thu, March 01, 2001, 14:19 EST (Coding, Hacking, & CS stuff)
(posted when I was 22 years old.)
so I'm taking a break from algorithms and messing around with C++. I discovered, to my great joy, that this code compiles (in g++, CC, and KCC) and works as I expected it to:
#include <iostream>
using namespace std;

class foo {
public:
  void a() { cout << "haha!" << endl; }
  void b() { cout << c << endl; }
private:
  int c;
};

int main(int argc, char* argv[])
{
  int q = 420;
  void* j = NULL;

  ((foo*)j)->a();
  ((foo*)&q)->b();

  return 0;
}

Now this is fun and all, but the real question is, how can I use this knowledge to my advantage? That is to say, how can I use this knowledge to really irritate abstraction purists...
This entry is rated 4.0000/5 based on 1 ratings. You have not rated this entry.