How to override c++ class like vector
问题 I'm trying to override the vector class and add a custom function to it, but coming from Java I'm not really familiar with the mechanics of overriding, inheriting and that kind of stuff. 回答1: The standard containers aren't polymorphic, so you can't override their behaviour; and have no protected members so there's no point inheriting from them to extend them. While you could do that, as suggested by another answer, you would have to reimplement all the constructors (or, since 2011, explicitly