C Sharp (C#) - Classes and Objects
Identify the error in this C# class that tries to track a score:
class Game {
int score;
public void AddPoints(int points) {
score = score + points;
}
public int GetScore() {
return score;
}
}
var g = new Game();
g.AddPoints(5);
Console.WriteLine(g.GetScore());