Error “Elements defined in a namespace cannot be explicitly declared as private, protected, or protected internal”

Because private means that the member is only visible in the containing class. Since a top-level class has no class containing it it cannot be private (or protected).
(Internal or public are valid modifiers though).

What would you want private to mean on a top-level class?

Of course all modifiers apply to nested classes, i.e. a class defined within another class.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)