vector<Base> foo;
Derived bar;
foo.push_back(bar);
, push_back :
void push_back ( const T& x );
Thus, the compiler will do an implicit down conversion and copy to the vector memory pool. No, inside is vector<Base>impossible to contain Derived. They will be Base.
If you add some virtual function to Base, then override it in Derived, create an object Derived, paste it in vector<Base>and then call it from a new vector object, you will see that the implementation Baseis called
source
share