#include <iostream>
using namespace std;

    struct baseItem {
        template <typename T> static T* createItem(int index) {
        	return new T(index);
        }
    };
    struct Sword : public baseItem {
    	Sword(int n) { cout << "Creating a sword number " << n << endl; }
    };


int main() {
	Sword *s = baseItem::createItem<Sword>(123);
	delete s;
	return 0;
}