No, Derived is also of type Base is not true.
It's true that Derived * is compatible with Base *.
The difference is between the actual object and the address of the actual object - since the derived one has the same vtable as the base, then it's ok to replace one with the other - as long as you go "down" (towards base) when replacing.
Also, the derived type's pointer is compatible, but it doesn't mean that a vector containing the base's pointer is compatible with a vector containing the derived pointer - these are two different types and the "explore compatible types" don't even come into it - the template class is not the same instance, so they are not compatible. It's the same as:
Code:
struct a
int x;
int y;
};
struct b
int x;
int y;
};
std::vector<a *> va;
std::vector<b *> vb;
va and vb are NOT compatible vectors, becuase the structs have different names - the content in the struct is the same, but the compiler says "You named these structs differently, so you obviously don't mean for them to be the same".
--
Mats