The title pretty much says it all. Basically, is it legal to do this:
class Base {
//stuff
}
class Derived: public Base {
//more stuff
}
vector<
vector foo;
Derived bar;
foo.push_back(bar);
This is equal to pushing Base object, because push_back is declared like this:
void push_back ( const T& x );
So, compiler will do implicit downgrading conversion and do copy into vector memory pool.
No, it is not possible to contain Derived inside vector. They will be Base.
If you add some virtual function to Base then override it in Derived, create Derived object, push it into vector and then call it from vector's new object, you will see that Base implementation is called