All my college years I have been using public
, and would like to know the difference between public
, private
, and protected
mmm...
Static means that you can access that function without having an instance of the class.
You can access directly from the class definition.
public - can be access by anyone anywhere.
private - can only be accessed from with in the class it is a part of.
protected - can only be accessed from with in the class or any object that inherits off of the class.
Nothing is like null but in VB.
Static means you have one instance of that object, method for every instance of that class.
Reposting the awesome diagrams from this answer.
Here are all access modifiers in Venn diagrams, from more limiting to more promiscuous:
private
:
private protected
: - added in C# 7.2
internal
:
protected
:
protected internal
:
public
:
Regarding the question of Nothing