c++11 - C++ casting a std::vector<Derived>* to std::vector<Base> ...? -
i'm making vector of pointers vectors:
std::vector<std::vector<base>*> all; // vector keeping pointers vectors and problem have several vectors of derived classes:
std::vector<derived1> derived1; // vector of derived class std::vector<derived2> derived2; // vector of derived class std::vector<derived3> derived2; // vector of derived class is there safe way change type of pointer vector<derivedx> vector<base>?
every derived class shares behavior , alive of program's life.
i'm still not @ explaining programming problems, should questions concerning details arise - please ask in comments.
no, not possible. there no relationship between std::vector<base> , std::vector<derived>.
in other words: std::vector<derived> not derived std::vector<base>.
Comments
Post a Comment