Hmm bizarre thing there
Anyway, this is a pointer to the instance of that class. What you're doing with the second one is you're passing a pointer rather than a class, so it shouldn't even compileThat should print "yep, &a is b"Code:#include <iostream> using namespace std; // Just making you standards-compliant :) class CDummy { public: int isitme(CDummy *param); // Using pointers instead, it's easier }; int CDummy::isitme(CDummy *param) { if(param == this) return 1; return 0; } int main() { CDummy a; CDummy *b = &a; if(b->isitme(&a)) cout <<"yep, &a is b\n"; else cout << "nope, don't know this one\n"; return 0; }![]()






Reply With Quote