S
Stephen Howe
Hi
If I have
#include <vector>
#include <string>
class MyClass
{
std::vector<int> a;
std::string b[5];
short c;
int d[3];
};
void FreeFunction()
{
MyClass m;
}
then the compiler will generate a default constructor.
The default constructor will call std::vector & std::string default
constructors for a, b.
But c, d members wont be initialised and could be anything for object
m inside FreeFunction.
Now consider that I have
static MyClass n;
void FreeFunction2()
{
static MyClass p;
}
Will the fact that these object are static, and for n, global as well,
mean that c, d will be 0?
Cheers
Stephen Howe
If I have
#include <vector>
#include <string>
class MyClass
{
std::vector<int> a;
std::string b[5];
short c;
int d[3];
};
void FreeFunction()
{
MyClass m;
}
then the compiler will generate a default constructor.
The default constructor will call std::vector & std::string default
constructors for a, b.
But c, d members wont be initialised and could be anything for object
m inside FreeFunction.
Now consider that I have
static MyClass n;
void FreeFunction2()
{
static MyClass p;
}
Will the fact that these object are static, and for n, global as well,
mean that c, d will be 0?
Cheers
Stephen Howe