「setSpeedX
すべてのコード パスが値を返すわけではない」というエラーに対して下線が引かれています。どうすれば解決できますか?コードは以下のとおりです。
class Ball
{
public int speedX { get; private set; }
public int speedY { get; private set; }
public int positionX { get; private set; }
public int positionY { get; private set; }
public Ball(int speedX, int speedY, int positionX, int positionY)
{
this.speedX = speedX;
this.speedY = speedY;
this.positionX = positionX;
this.positionY = positionY;
}
public int setSpeedX(int newSpeedX)
{
speedX = newSpeedX;
}
public int setSpeedY(int newSpeedY)
{
speedY = newSpeedY;
}
public int setPositionX(int newPositionX)
{
positionX = newPositionX;
}
public int setPositionY(int newPositionY)
{
positionY = newPositionY;
}
}
ありがとうございました。