#166124 - Echo49 - Fri Jan 30, 2009 12:46 pm
I have code similar to the following:
The first iprintf outputs the correct value as expected, but the one after the constructor returns is a totally different value. Any idea what is causing this - some sort of stack corruption?
Code: |
class Object
{ public: Object(int value); int getValue() { return mValue; } protected: int mValue; }; Object::Object(int value) { mValue = value; iprintf("%i", mValue); } int main() { Object o(100); iprintf("%i", o.getValue()); } |
The first iprintf outputs the correct value as expected, but the one after the constructor returns is a totally different value. Any idea what is causing this - some sort of stack corruption?