コンテキストのコード:
class a
{
}
class b
{
public a a{get;set;}
public static implicit operator a(b b)
{
return b.a;
}
}
a a=null;
b b=null;
a = b;
//compiler: cannot apply operator '==' to operands of type tralala...
bool c = a == b;
異なるタイプのインスタンスで==演算子を使用することは可能ですか?暗黙的に別のインスタンスに変換できますか?私は何を取りこぼしたか?
編集:
タイプが同じ呼び出し==でなければならない場合、なぜ
int a=1;
double b=1;
bool c=a==b;
動作しますか?