Why doesn't C # allow implicit reference conversions from interface type to class?
Given:
public class T
{
public static implicit operator T(R r)
{
return new T();
}
}
public class S: R { }
public class R { }
If R is an interface, the code will not compile:
custom conversions to or from the interface are not allowed
Interfaces are essentially public / inner classes with all public members and no implementation. So what is the purpose of this limitation?
+3
source to share
No one has answered this question yet
See similar questions:
or similar: