I come from a C# background, where I would be able to do something like this
void AddComponent<T>() where T : Component, new()
{
T newT = new T();
//Do other things...
ListOfComponents.Add(newT);
}
I'm rather new when it comes to C++ Templates, but after visiting a number of tutorials and sites, I haven't been able understand how to replicate this.
Does anyone know if this is possible in C++ using templates?
Aucun commentaire:
Enregistrer un commentaire