[FIXED] Incorrect variable declaration in C# lesson on Basic Classes and Objects - Properties

At the top of this exercise on defining properties, the example Area is defined as an integer which is what you would expect i.e.

public int area;
public int Area
{
get { return area; }
set { area = value; }
}

However, further down it has become a string:

public string Area
{
get { return area; }
set
{
if (value < 0) { area = 0; }
else { area = value; }
}
}
No explanation is given for this. Please help.

1 Like

Definitely seems to be a typo. It should be “public int Area” in the second snippet as well.

1 Like

Good eye, @jez1984.

Thanks for your verification as well, @mtrtmk. I’ve just reported the bug directly to the CC engineering team.

For reference here’s a screenshot of the bug:
image
and a link to the exercise.

1 Like

Thank you, @jez1984 & @mtrtmk, for reporting the issue. It has been corrected.

1 Like