Hi, I'm trying to do a class that will be able to allocate an array of derives class
by having an array of pointer of a root class. Then I'd call a method that receives
a template representing the child class to affect on one of the pointers in the array.
So I could be able to call new with a template to allocate different kind of pointers.
I don't really know how to do this but I started with void pointers. So I want to be
able to pass the template with the method to allocate one of the pointer to data
of T type, that will change every time the method is called. I don't want the template
to affect the whole class, in the way that the class will only hold one type...
But I get errors because the method has to be static and then I don't have the
rights to use NEW on non-static data or something...
Code:class foo { void *a[10]; int b; public: template <class T> static void func(void) { a[b] = new T; b++; } };
how could I do this?