blob: b40598cff4907ef70a80a028ca180b6d6d70072e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
using System;
class A {
public virtual void Foo (int i) { }
public virtual void Foo (double d) {
throw new Exception ("Shouldn't be invoked");
}
public virtual bool this [int i] {
get { return true; }
}
public virtual bool this [double d] {
get { throw new Exception ("Shouldn't be invoked"); }
}
}
class B : A {
public override void Foo (double d) {
throw new Exception ("Overload resolution failed");
}
public override bool this [double d] {
get { throw new Exception ("Overload resolution failed"); }
}
public static void Main () {
new B ().Foo (1);
bool b = new B () [1];
}
}
|