+ 1

Why this error? C#, class inaccessible due to protection level

https://code.sololearn.com/cM9S00A0580C/?ref=app

19th Oct 2019, 4:31 AM
Sarthak
Sarthak - avatar
4 Antworten
+ 3
You have a static method 'hello()' within a public class 'hellow' wrapped in a namespace 'prog'. You can access it as: hellow.hello(); or prog.hellow.hello(); if you do not declare the use of namespace prog.
19th Oct 2019, 4:41 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
The method 'hello()' is in a different class (the hellow class), and therefore must be accessed as such. Because it is a static method, it can be accessed statically: hellow.hello();
19th Oct 2019, 4:39 AM
Brian R
Brian R - avatar
+ 1
Put the class name (hellow) before its method (hello)
19th Oct 2019, 4:40 AM
Bilbo Baggins
Bilbo Baggins - avatar
+ 1
Hatsy Rei it means, System is not a class?
23rd Oct 2019, 9:37 AM
Sarthak
Sarthak - avatar