hi
i have a class so
now another in main:Code:class CFood { private: BOOL isnice; BOOL isbad; public: CFood( BOOL a, BOOL b ); void Eat(); }; CFood::CFood( BOOL a, BOOL b ) { isnice = a; isbad =b; }
how access isnice?Code:int main() { CFood food = new CFood( TRUE, FALSE ); }
my teacher tell me, to get isbad, need to do this
now, how to access isnice????Code:int main() { CFood food = new CFood( TRUE, FALSE ); BOOL isbad = *(BOOL*)(((char*)food)+sizeof(BOOL)) }
thx