There is no argument given that corresponds to

Hi,

In my opinion, there is no such thing as a stupid question as long as you are genuinely interested in the answer. Feel free to ask. Even if the solution/answer reveals itself to be very simple, that would be absolutely fine. :slight_smile:

The answer is simple in this case but the question is great because it allows you to learn one of the most important features of C#: method overloading.

From what I see in your code, you probably already know method overloading but I assume you are more familiar with JavaScript (or another programming language) than with C#.

Check the definition of your getNextStates method in the State class. It is defined with a parameter, thus you need to call the method and pass on an argument. That’s how C# works.

What you could try is to define a default value:
public State[] getNextStates(int selection = 0)

I think, in that case, you don’t have to pass on an argument when calling the method.

Did this help?


See also:

1 Like