- Mar 12, 2000
- 8,324
- 2
- 0
For example, let's say we have a default constructor like:
MyClass::MyClass()
{
ptrStuff = NULL;
}
And another constructor that calls the above constructor:
MyClass::MyClass(int a, int b)
{
MyClass();
// do stuff
}
I'm running into problems when I do the above. The ptrStuff is a private class variable and it doesn't seem to be set to NULL after returning from the default constructor. I thought I used to be able to do this. I'm working with C++ at work but I recently took a Java class and this has gotten me confused about C++ stuff.
MyClass::MyClass()
{
ptrStuff = NULL;
}
And another constructor that calls the above constructor:
MyClass::MyClass(int a, int b)
{
MyClass();
// do stuff
}
I'm running into problems when I do the above. The ptrStuff is a private class variable and it doesn't seem to be set to NULL after returning from the default constructor. I thought I used to be able to do this. I'm working with C++ at work but I recently took a Java class and this has gotten me confused about C++ stuff.
