Visibility
public - the member can be reached from anywhere. This is the least restrictive visibility. Enums and interfaces are, by default, publicly visible.
protected - members can only be reached from within the same class, or from a class which inherits from this class.
internal - members can be reached from within the same project only.
protected internal - the same as internal, except that also classes which inherits from this class can reach it members, even from another project.
private - can only be reached by members from the same class. This is the most restrictive visibility. Classes and structs are by default set to private visibility.
So for instance, if you have two classes, Class1 and Class2, private members from Class1 can only be used within Class1. You can't create a new instance of Class1 inside of Class2, and then expect to be able to use its private members.
If Class2 inherits from Class1, then only non-private members can be reached from inside of Class2.
Having problems with this chapter? Ask in our forums!
© net-tutorials.com 2006 - 2008