Wednesday, April 27, 2011

Access Modifier

Private: If we define a variable in a class as private, then we cannot use that variable further more in any different class.


Public: If we define a variable in a class as public, then we can use that variable further more in any class.

Protected: If we use a protected access modifier for a variable or method, then they can be accessible by their inherited classes only.

Internal: If we declare a variable as internal, then we can use this variable with in the library. This access modifier can only be used for library functions.

Protected internal: This is same as protected but the only difference is, it is useful only in libraries.

No comments:

Post a Comment