Re:Re: Wierd constructor problem. Please help!
Hello, All.
I am creating an instance of a TClassA object.
TClassA a(var1, var2, var3);
The above constructor calculates all the data members of the object 'a.'
There are six data members of TClassA, three floats and three user
defined types.
TypeA object1;
TypeB object2;
TypeC object3;
float object4;
float object5;
float object6;
The variables in the constructor, var1, var2, and var3 are used to
calculate the above data members. These data members are all private.
After I create 'a' via
TClassA a(var1, var2, var3);
I test the above six objects by doing
TypeA test1 = a.GetObject1();
TypeB test2 = a.GetObject2();
TypeC test3 = a.GetObject3();
float test4 = a.GetObject4();
float test5 = a.GetObject5();
float test6 = a.GetObject6();
and then I "watch" the above six objects, test1, test2, etc. Now I come
to the problem. All of the values are what they should be except the
float test5. If test5 should be, e.g., 4, I might see in the watch
window that test5 is 1.34432E-32. Here's the wierd part. If I watch
this variable
a.object5
it will display the correct value, 4.0. But test5 shows 1.34432E-32.
Morover, if I do this
float test7 = a.GetObject5();
float test8 = a.GetObject5();
float test9 = a.GetObject5();
float test10 = a.GetObject5();
I do not see test7 = test8 = test9 = test10. I get different values for
each of them! Also, if, when I get to
TClassA a(var1, var2, var3);
I step into this contsructor of TClassA, a.object5 is calculated
correctly and I am able to 'watch' that object5 is 4.0 (as it should be)
before I exit the constructor. But when I step to the line of code below
the declaration of 'a', I get the above described wierd behavior. Anyone
have any idea what's going on? Thanks for much for your help!
-Rob