FastNetMon

Wednesday, 16 September 2009

this == NULL ?


#include <iostream>

class suxx {
public:
void m() {printf("call! num %d ptr %p", this, this);}
};

int main() {
suxx* o = new suxx;

o->m();
o = NULL;
o->m();

return 0;
}


И Вы тоже не ожидали?

./a.out
call! num 72347664 ptr 0x44ff010call! num 0 ptr (nil)

1 comment :

Note: only a member of this blog may post a comment.