These are used to
provide restriction to the members of a class or class to access in same class
or in derived class in same Assembly or different Assembly etc.
.NET supports Five
types of Access Modifiers
1. private:
Private Members are accessible only within the same class
2. protected: Protected
Members are accessible within the same class and also in the derived class,
derived class might be in same assembly or in different assembly
3. internal: Internal
Members are accessible in any class within the same assembly but not accessible
in any class outside the assembly
4. Protected internal: This is
combination of both Protected and Internal i.e. protectedinternal members are
accessible in any class with in the same assembly and also from the derived classes
outside the assembly, but not accessible from the Non-Derived classes outside
the assembly
We can summaries all these in a table like given below, in this table ‘×’ represents Not Accessible and √ represents Accessible
No comments:
Post a Comment