I thought that I knew how to handle structures, since I have programmed in C for years. However, I have come across this struct definition in a C# program that I am attempting to understand. It is populated with booleans and each instance of the struct is going to be a cell in an array (not shown here). I expect that the override in line 3 is used to override a method "ToString()" in a base class.
public struct Cell
{
public bool occupied;
public Cell(bool occupied) { this.occupied = occupied; }
public override string ToString() { return occupied ? "x" : "."; }
}
I understand the first line above. I believe that I am confused about the use of methods in structures, as I am assuming that the second and third lines in the above struct definition are methods. The second line is very confusing to me.
Thank You Tom