Thats because MyClass is a template class. Templates are note types, instansiations of templates can be types.
e.g.

    Myclass!float[] arr; // note this is not MyClass!(float[]);

will work. As Rikki suggested using Object[] instead will allow use to store classes of different types.

Maybe I must use some stub class or interface and override all methods... But I so like D templates, as a result it's a small and easy to understand code.

Or actually it's maybe a XY problem. I'm trying to implement OpenGL material manager and for OpenGL uniforms I tried to write:
```
abstract class Uniform(T)
@property ...
@property ...
T _val;...
void method()...
...
class FloatUniform: Uniform!float
...
override void method()...

And in material class
class Material
...
Texture[] textures;
Uniform[] uniforms;
...
```
Maybe i'm totally wrong and better just use glUniformXXX... in my main app instead of
```
auto uniform = new SomeTypeUniform...
...
uniform.value = someValue;
```
?

Reply via email to