Hello,
I'm wondering when is necessary/better declare a pointer to an object in a class or a pointer to a vector in a class
class A {
public:
vector<flaoat> fvec;
//or
vector<float>* fpvec;
A() {
fvec.resize(1000);
//or
fpvec = new vector<float>(1000);
}
};
class A {
public:
vector<flaoat> fvec;
//or
vector<float>* fpvec;
A() {
fvec.resize(1000);
//or
fpvec = new vector<float>(1000);
}
};
To copy to clipboard, switch view to plain text mode
What's the thing that lead me to opt one or other?
THe same question if I had a Person p[10]; in the class. Should be better take a pointer to an array of person? How to choice?
thanks
Bookmarks