以下の例では、なぜother.age
0ではなく88を出力するのですか?
#include <atlstr.h>//CString for non-MFC
class A
{
public:
A() : name("Nobody"), age(0) {}
~A(){};
A( CString name, unsigned age ) : name( name ), age( age ) {}
A& operator=( const A& ref )
{
name = ref.name;
age = 0;
}
CString name;
unsigned int age;
};
int _tmain( int argc, _TCHAR* argv[] )
{
A person( CString("Michael"), 88 );
A other = person;
std::cout << other.name << std::endl << other.age;
}