下面类的索引定义或使用正确的是()。
已帮助 人
下面类的索引定义或使用正确的是()。
A.class MyClass{ int x; int y; public int this[int index] { get{ if (index==0) return x; else return y; } } }
B.class MyClass{ int x; int y; public int this[int index] { set{ if (index==0) x=value; else y=value; } } }
C.class MyClass{ int x; int y; public int INDEX[int index] { get{ if (index==0) return x; else return y; } set{ if (index==0) x=value; else y=value; } } }
D.class MyClass{ int x; int y; public int this[int in

回答
共1条回复-
class MyClass{ int x; int y; public int this[int index] { get{ if (index==0) return x; else return y; } set{ if (index==0) x=value; else y=value; } } }
