This will leak memory, because nobody is deleting the vector you "new"-ed.
Also, why have a pointer to a vector at all? Are you worried about copying it into the constructor being expensive?
Change the member to be a vector:
class A{
public:
A(vector<CCPoint> p);
private:
vector<CCPoint> p;
}
Change the constructor to use the initialiser list:
A:A(vector<CCPoint> newP) : p(newP){
// Empty
}
And call like this:
Vector<CCPoint> p;
A a(p);
Never, ever create an object with "new" unless you know exactly why you are doing so, and even then, reconsider.
Performance Note: Yes this may cause a vector copy to occur, depending on copy elision by the compiler. An alternative C++11 fancy pants solution would be to use move:
class A{
public:
A(vector<CCPoint> p);
private:
vector<CCPoint> p;
}
A:A(vector<CCPoint> newP) : p(std::move(newP)){
// Empty
}
Vector<CCPoint> p;
A a(std::move(p)); // After this completes, 'p' will no longer be valid.