hi Guys,
well i have a small issue (i think). i have a class that only contains one variable and i was wondering if i could assign an object of this class, to a variable of the same type as it's only data member by type casting this class. (among other things) i have tried the following but i get compile errors:
with reinterpret_cast also doesn't work:Code:class A { private: int a; }; int main(int argc, char* argv[]) { A objA; int b; b = (int)objA; return 0; }
can it be done?Code:b = reinterpret_cast<int>(objA);



LinkBack URL
About LinkBacks


