-
Notifications
You must be signed in to change notification settings - Fork 1
Access Modifiers
What each access modifier means on each kind of declaration
Default : public
Allowed :
-
public
:-
namespace : ILLEGAL
-
global : Visible to every file that import the project
-
-
internal
:-
namespace : ILLEGAL
-
global : Only visible to files within the project
-
Note : These are only valid for methods or namespaced functions, and not global functions. Putting an access modifier on a global function a) doesn't mean anything, and b) is illegal.
Default : private
Allowed :
-
public
-- Visible to every file -
internal
-- Only visible to files within the project -
protected
-- Visible to all derived types of the containing class -
protected internal
-- Visible to all derived types of the containing class, given that the types are within the project -
private
-- Only visible to the containing type
Note : By default, this assumes that
-
Every type is declared within a namespace, and
-
The other files use/import or are within said namespace
When this is not the case, the behavior will be listed as namespace, i.e. the type is declared within a namespace and global, i.e. the type is declared outside of a namespace
Default : public
Allowed :
-
public
-- Visible to every file -
internal
-- Only visible to files within the project -
protected
-- Visible to all derived types of the containing class- Valid only for nested types
-
protected internal
-- Visible to all derived types of the containing class, given that the types are within the project- Valid only for nested types
-
private
-- Only visible to the containing class- Valid only for nested types
Default : public
Allowed :
-
public
-- Visible to every file -
internal
-- Only visible to files within the project