On Tuesday, 29 November 2016 at 15:56:23 UTC, Jerry wrote:
To avoid having to use the Object class directly you can make
an base class of the class template.
Like:
```
abstract class MyClass {}
abstract class MyClassImpl(T)
{
public:
@property const(T) value(){return _value;}
@property void value(T val){_value = val;}
...
private:
T _value;
...
}
MyClassInt and float inherits from MyClassImpl
```
And use it like:
```
void main() {
MyClass[] objs;
objs ~= new MyClassFloat();
objs ~= new MyClassInt();
}
```
Yes, but anyway you need to downcast if(MyClassBlahBlah subclass
= cast(MyClassBlahBlah)obj)...
So it's not much sense to have base class or interface MyClass.