Your code makes no sense to me at all. What on earth does a game class template model, and why does it have those four member variables? What does it all mean?
My suggestion is that you stop defining class templates. You almost certainly don't need it here. When you define your base class, think about what does it model, and declare the appropriate virtual member functions.
Here's a contrived example of "printing out subclass objects":
Code:
#include <iostream>
#include <ostream>
#include <vector>
class A
{
public:
virtual void print(std::ostream& out) const
{
out << "This is an object of class A.";
}
virtual ~A() {}
};
std::ostream& operator<<(std::ostream& out, const A& obj)
{
obj.print(out);
return out;
}
class B : public A
{
public:
virtual void print(std::ostream& out) const
{
out << "This is an object of class B, derived from class A.";
}
};
class C : public A
{
public:
virtual void print(std::ostream& out) const
{
out << "This is an object of class C, derived from class A.";
}
};
int main()
{
using namespace std;
A a;
B b;
C c;
vector<A*> items;
items.push_back(&c);
items.push_back(&b);
items.push_back(&a);
for (auto item : items)
{
cout << *item << endl;
}
// or if you cannot use the above loop:
//for (vector<A*>::iterator iter = items.begin(); iter != items.end(); ++iter)
//{
// cout << **iter << endl;
//}
}
Notice that I declared A's destructor to be virtual, which is not important here but could matter when you use new and delete.