Original Post
class Base
{
...
std::string name;
};
template<N>
class Derived : public Base
{
void MyDerivedFunction();
...
float data[ N ];
};
Base* array[ 512 ];
//do something with the Derived* objects...
for( int i = 0; i < whatever; ++i )
{
Derived* ptr = dynamic_cast< Derived* >( array[ i ] );
if( ptr )
{
....
}
}
#define ARBITRARY_NUMBER 5
//do something with the Derived* objects...
for( int i = 0; i < whatever; ++i )
{
Derived<ARBITRARY_NUMBER>* ptr = dynamic_cast< Derived<ARBITRARY_NUMBER>* >( array[ i ] );
if( ptr )
{
//do something
ptr->MyDerivedFunction();
}
}