Originally Posted by CornedBee
EDIT: OK, why is this?
Test( n, NULL );
Test(std::string n, Test* other): name( n )
test = other;
//This says it is zero when I call other constructor, so it's right
if ( test == 0 ) printf( "null in constructor" );
const char* print()
//This does NOT print out, somehow it's no longer 0
if ( test == 0 ) printf( "null in print" );
Test t( "name" );
//This says it's not null
If I change the first constructor to this:
Test(std::string n) :name( n );
test = NULL;
then it works!! Why? What's the difference?