c# 的访问修饰符是private 还是 internal?
2011-04-17 16:48
267 查看
准确的说,不能一概而论。
[MSDN]
Classes and structs that are not nested within other classes or structs can be either public or internal. A type deleted as public is accessible by any other type. A type deleted as internal is only accessible by types within the same assembly. Classes and structs are deleted as internal by default unless the keyword public is added to the class definition, as in the previous example. Class or struct definitions can add the internal keyword to make their access level explicit. Access modifiers do not affect the class or struct itself — it always has access to itself and all of its own members.
类(class)或结构(struct)如果不是在其它类或结构中的话,它的访问类型要不就是internal, 要不就是public;
换句话说,如果它在其它类或结构中的话,则可以为private 或protected等。下面我说的类和结构,如无特殊说明,均指非"类中类"
类或结构的默认访问类型是internal.
类中所有的成员,默认均为private。
[MSDN]
Classes and structs that are not nested within other classes or structs can be either public or internal. A type deleted as public is accessible by any other type. A type deleted as internal is only accessible by types within the same assembly. Classes and structs are deleted as internal by default unless the keyword public is added to the class definition, as in the previous example. Class or struct definitions can add the internal keyword to make their access level explicit. Access modifiers do not affect the class or struct itself — it always has access to itself and all of its own members.
类(class)或结构(struct)如果不是在其它类或结构中的话,它的访问类型要不就是internal, 要不就是public;
换句话说,如果它在其它类或结构中的话,则可以为private 或protected等。下面我说的类和结构,如无特殊说明,均指非"类中类"
类或结构的默认访问类型是internal.
类中所有的成员,默认均为private。
相关文章推荐
- MonoDevelop开发笔记,c#中类的默认访问修饰符,是private还是internal
- 深入浅出OOP(五): C#访问修饰符(Public/Private/Protected/Internal/Sealed/Constants)
- C#共有五种访问修饰符:public、private、protected、internal、protected internal。作用范围如下表:
- C#共有五种访问修饰符:public、private、protected、internal、protected internal.
- C#中的访问修饰符(public/private/protected/internal/protected internal)
- c#访问修饰符 (public、protected、private、protected、 internal)
- C# 访问修饰符 public、private、protectrd、internal、protected internal 访问权限
- C#访问修饰符(Public/Private/Protected/Internal)
- 深入浅出OOP(五): C#访问修饰符(Public/Private/Protected/Internal/Sealed/Constants)
- C# 访问修饰符 public、private、protected、internal
- c#中访问修饰符public、private、protected、internal的区别
- c#中访问修饰符public,private,protected,internal,protected internal的区别
- C#访问修饰符(public、protected、internal、private的比较)
- 黑马程序员—C#访问修饰符 public、private、protected 和 internal
- 转的。一个C#的问卷!private、 protected、 public、 internal 修饰符的访问权限
- C#访问修饰符:public、protected、internal、private
- C#访问修饰符:public、protected、internal、private
- 一个C#的问卷!private、 protected、 public、 internal 修饰符的访问权限
- C#中。简述 private、 protected、 public、 internal 修饰符的访问权限
- 一个C#的问卷!private、 protected、 public、 internal 修饰符的访问权限