Mega Code Archive

 
Categories / C++ / Class
 

Need reinterpret_cast to go from pointer to int and from int to pointer

class X {}; class Y {}; int main(int argc, char** argv) {   int i = 3;   X x;   Y y;   X* xp;   Y* yp;   i = reinterpret_cast<int>(xp);   xp = reinterpret_cast<X*>(i);   return (0); }