I’m reading the book “C# Language”, and hit this note from Vladimir Reshetnikov:
If a static class declares a protected or
protected internal member, a compile-time error occurs (CS1057).
May I know why?
What’s wrong with a static class having a protected member?
Static class can have private member so I guess this CS1057 error is not due to accessibility, but maybe it’s due to come compilation issue? as protected member could be overridden in child classes… but I couldn’t figure out why.
Because you can’t inherit a static class,
protectedserves no purpose – onlypublicandprivatemake sense here.More details can be found here: Why can't I inherit static classes?