public class Posicion
{
public Posicion()
{
x = 0;
y = 0;
}
private int _x;
private int _y;
public int x
{
get { return _x; }
set
{
if (value < 0)
throw new ArgumentException(String.Format("{0} debe ser mayor a 0",
nameof(value)));
_x = value;
}
}
public int y
{
get { return _y; }
set
{
if (value < 0)
throw new ArgumentException(String.Format("{0} debe ser mayor a 0",
nameof(value)));
_y = value;
}
}
}