Z
zl2k
hi, all
Suppose I have the following header file:
#include <vector>
using namespace std;
class Test{
public:
~Test();
Test();
private:
vector<int> v;
vector<vector<int> > vv;
}
Then in the Test.cpp, I have
Test::Test() : v(0), vv(0){}
Am I initialize the vector correct? At the time when the constructor is
excuted, I don't have the number to fill the vector yet, so I put them
to size of 0. (It seems I initialize them to null, but null is not
initialized, right?) Please correct me if I am doing wrong. I got
strange run time errors which indicating some of the parameters are not
initialized correctly. Thanks for help.
zl2k
Suppose I have the following header file:
#include <vector>
using namespace std;
class Test{
public:
~Test();
Test();
private:
vector<int> v;
vector<vector<int> > vv;
}
Then in the Test.cpp, I have
Test::Test() : v(0), vv(0){}
Am I initialize the vector correct? At the time when the constructor is
excuted, I don't have the number to fill the vector yet, so I put them
to size of 0. (It seems I initialize them to null, but null is not
initialized, right?) Please correct me if I am doing wrong. I got
strange run time errors which indicating some of the parameters are not
initialized correctly. Thanks for help.
zl2k