Board index » cppbuilder » Disappearing AnsiStrings
Dan Wilson
![]() CBuilder Developer |
Disappearing AnsiStrings2005-04-30 12:28:21 AM cppbuilder91 I have a class which has AnsiStrings as class members: class MyClass { protected: AnsiString strName; AnsiString strConfigName; public: MyClass( AnsiString strNewName ); } In the constructor, I initialize the string members: MyClass::MyClass( AnsiString strNewName ) { strName = strNewName; strConfigName = "PrependedInformation"; strConfigName += strNewName; } When I single-step through this, strNewName has the correct value. strName and strConfigName are empty strings on entry to the constructor, as expected, but never get anything stored into them: they are still empty strings at the end of the function. So I added this: MyClass::MyClass( AnsiString strNewName ) { AnsiString strMyName = strNewName; strName = strMyName; .... } strMyName is initialized with the correct value from strNewName. strName remains an empty string. I'm baffled. This code worked at one time; now it doesn't. Thanks for any help that anyone can give! Dan. |