//: generics/InstantiateGenericType.cpp // ©2015 MindView LLC: see Copyright.txt // C++, not Java! template class Foo { T x; // Create a field of type T T* y; // Pointer to T public: // Initialize the pointer: Foo() { y = new T(); } }; class Bar {}; int main() { Foo fb; Foo fi; // ... and it works with primitives } ///:~