dev/cpp/this/this.cpp

26 lines
344 B
C++
Raw Normal View History

#include <iostream>
#include <stdlib.h>
using namespace std;
class foo {
public:
void *operator *() {
return NULL;
}
void *bar() {
return &*this;
}
};
int main(int argc, char *argv[])
{
foo f;
cout << (unsigned long)f.bar() << endl;
cout << (unsigned long)&f << endl;
cout << (unsigned long)*f << endl;
return EXIT_SUCCESS;
}