public class Pointer
{
public int x, y;
public int this [int i]
{
get {<-----Вот здесь ошибка}
{
switch (i)
{
case 0:
return x;
case 1:
return y;
}
}
set
{
switch (i)
{
case 0:
x = value;
break;
case 1:
y = value;
break;
}
}
}
public Pointer(int x, int y)
{
this.x = x;
this.y = y;
}
public Pointer(Pointer rhs)
{
this.x = rhs.x;
this.y = rhs.y;
}
public static Pointer operator + (Pointer lhs, Pointer rhs)
{
Pointer Result = new Pointer(lhs);
Result.x += rhs.x;
Result.y += rhs.y;
return Result;
}
}
Сама ошибка:
Цитата
Error 1 'Consoled.Program.Pointer.this[int].get': not all code paths return a value D:\d&s\Artem28\Рабочий стол\C++\Console\Console\Program.cs 15 17 Consoled
Как исправить?