On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote:
Hi,consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() {Base foo = new Foo(); // This would be the result of a factory class(cast(FeatureX)foo).x(); // 1 }1) error: casting to interface FeatureX is not allowed in @safe code.Question: How to call foo.x in @safe code ?
That's because foo is of type Base, not implementing FeatureX.