I have an interface that I would like to make sure that any classes derived from it will use alias this, else it can potentially break code.

interface A(T)
{
    @property T Value();
    @property T Value(T value);
    // need to enforce alias _value this somehow
}

class B(T) : A!T
{
    private T _value;
    @property T Value() { return _value; }
    @property T Value(T value) { return value = _value; }
    alias _value this;
    // B must use alias this so B(T) behaves like type T
}

Reply via email to