The big two are
public
and
private
and all they do is say how much of you class can be seen by the outside world.
Anything you declare as
private
can only be accessed within the class itself:
public class MyClass
{
private void myFunction(){}
...
myFunction();
...
}
...
MyClass mc = new MyClass();
mc.MyFunction();
Anything you declare as
public
can be accessed by any code anywhere.
The others fall in the middle of these two:
protected
means that it is only available within the class, and in any class derived from the class. It's
private
but with special access given to derived classes.
internal
means
public
to classes within the same assembly, and
private
to classes outside teh assembly. So if you build your own DLL, all your classes in side the DLL can access the objects, but classes which reference your DLL cannot see them.
protected internal
is a combination of
protected
and
internal
- they are visible within the assembly exactly like
internal
objects, but they are also visible to derived classes outside, the same as
protected