P
pocmatos
Hi all,
Imagine I have:
class X {
public:
// Some methods...
private:
vector<MyObject*> vec;
};
I think that the default copy constructor will just copy an object of
this class into a new one where vec is new by the pointers inside vec
will point to the exact same place as the original one, right? It'll
not copy MyObject also, right?
If I want this I'll have to implement my own copy constructor... i.e.
I'll have to implement X(X&) and operator= on X, right?
This is just my intuition but I would appreciate some feedback, thanks.
Cheers,
Paulo Matos
Imagine I have:
class X {
public:
// Some methods...
private:
vector<MyObject*> vec;
};
I think that the default copy constructor will just copy an object of
this class into a new one where vec is new by the pointers inside vec
will point to the exact same place as the original one, right? It'll
not copy MyObject also, right?
If I want this I'll have to implement my own copy constructor... i.e.
I'll have to implement X(X&) and operator= on X, right?
This is just my intuition but I would appreciate some feedback, thanks.
Cheers,
Paulo Matos