I am fairly new to C# programming so this is likely a beginner's question.
I get a "'A.Test.That.Fails' is inaccessible due to its protection level" error on the following code snippet and I fail to understand the reason.
namespace A
{
class Test
{
public void Demo()
{
That[] it = new That[42];
it[0].fails = 21;
}
public struct That
{
int fails;
}
}
}
Coming from C++ programming and having read that protection rules are almost the same, since there is a single class I would expect it to work even if both the That
struct and the Demo
method were private
.
As the side note, a link to some page summing up scope and protection rules toward the C++ programmer would be greatly appreciated.