In the below code I am simply trying to experiment with a Heterogeneous std::list where I have stored three Derived class object in a list of type Base*. When retrieving data fr
Easiest way might be to define Base like so:
class Base { public: virtual const std::string& getData() = 0; }
And then have your various derived classes implement getData() as appropriate. That way, your output loop could just be:
getData()
for (Base* b : l) { cout << b->getData(); }