For the code below:
#include
#include
using namespace std;
class Foo2;
class Foo3;
template
class Foo1 {
pub
Despite your assertions to the contrary, the example you've given could be solved with std::list
:
std::list list;
list.push_back(new Foo2());
list.push_back(new Foo3());
for (std::iterator it = list.begin(); it != list.end(); ++it)
{
(*it)->print();
}
Obviously, there's a potential memory leak here...