/* bar.h */ class bar{ /* standard stuff omitted */ std::vector foo; }; /* bar.cpp */ bar::bar(){ // foo = new std::vector();
Because std::vector does that for you :) You don't have a pointer to std::vector, you're simply setting up an object of type std::vector, which internally allocates memory for you.
std::vector