日期:2014-05-17 浏览次数:20923 次
public class iii
{
public static implicit operator int(iii x)
{
return 0;
}
public static implicit operator iii(int x)
{
return null;
}
public static int operator +(int aa, iii bb)
{
return 0;
}
}
public class IntArray
{
public static implicit operator int[](IntArray x)
{
return x.data;
}
public static implicit operator IntArray(int[] data)
{
return new IntArray(data);
}
int[] data;
public IntArray(int[] data) { this.data = data; }
/// <summary>
/// 两个int型数组相加
/// </summary>
/// <param name="arr1"></param>
/// <param name="arr2"></param>
/// <returns></returns>
public static IntArray operator +(int[] arr1, IntArray arr)
{
//int[] arr1 = arr;
int[] arr2 = arr;
for (int i = 0; i < arr2.Length; i++)
{
arr1[i] += arr2[i];
if (arr1[i] > 9)
{
&