Thank u so much Uolj, at last i made the program work. I confess that i´m a novice in c++ and i really dont see other way than this to make a program where different derived class objects are stored in a vector or array. Why is this a poor programming practice? Does anyone knows other way?
Hi everybody! I´m trying to make this program where i store in a vector different types of derived objects from a single base class. So i declare the vector like this:
vector<BaseClass> vec;
then, assuming that all derived objects are, naturally, base class objects i push a DerivedClass object...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.