a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
25 lines
317 B
C#
25 lines
317 B
C#
// CS0266: Cannot implicitly convert type `B' to `I'. An explicit conversion exists (are you missing a cast?)
|
|
// Line: 21
|
|
|
|
interface I { }
|
|
|
|
class A : I { }
|
|
|
|
class B
|
|
{
|
|
public static explicit operator A (B from)
|
|
{
|
|
return new A ();
|
|
}
|
|
}
|
|
|
|
class App
|
|
{
|
|
public static void Main ()
|
|
{
|
|
B b = new B ();
|
|
I i = b;
|
|
}
|
|
}
|
|
|