Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, everyone.

I made a class and I initialize a const bool value in constructor.
And I didn't make any code to change the value in the class.
But after an object is created, its value is changed.
I checked encoding, but there was no problem.
(In my project, unicode should be used.)
I don't have any idea the reason.
Can you give me any advice?

I develop C++ program with visual studio 2013 in Windows 8.1.

C#
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// constructor
CCube::CCube( const bool bControlCtrlPts )
    : _bControlCtrlPts( bControlCtrlPts )
{
}
Posted

the most common cause of that are memory changes because of errors in pointers. You must watch when the change occurs.

Debugging the memory should help: How to: Set a Data Breakpoint. Or you must write trace code.
 
Share this answer
 
Just to be sure: How is the member _bControlCtrlPts declared?

If it is const (which would be useless), you would get a warning:
warning C4512: 'CCube' : assignment operator could not be generated


It it is not const, the member variable is set by the constructor to the passed value.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900