13. C# - Public Access Modifier

 Access modifier allows or restricts access to types or variables etc.


Adding a "public" in front of a type,method,statement will let it be access outside of the scope it is within.


Format:

[ACCESS MODIFIER] [TYPE] [VARIABLE_NAME]


Example for Variable:

public String Dog;

Dog = "Benny";


Example for Methods/Functions:

public void MethodName(){

    whatever inside

}

// methods/functions need to return a value. If dont need to return, then add "void" in front of method's name.

Comments

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort