Inaccessible due to its protection level?

前端 未结 5 590
臣服心动
臣服心动 2020-12-21 05:39

I\'m still quite new to coding in general, and while this simple program is only meant to be a test to learn how constructors work, I\'d still like to know why I\'m getting

5条回答
  •  鱼传尺愫
    2020-12-21 06:28

    This is not caused by the constructor. You get the error because the field methodTest.b is private (in C#, fields are private by default; you need to specify an explicit modifier, so something like public int b;).

提交回复
热议问题