zoukankan      html  css  js  c++  java
  • c# 的访问修饰符是private 还是 internal?

    准确的说,不能一概而论。


    [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。

  • 相关阅读:
    CCF真题之Z字形扫描
    CCF真题之门禁系统
    A
    安装 Spring 框架库
    安装 Apache Commons Logging API步骤
    Manven下载
    669. 修剪二叉搜索树
    UnixLinux | 总结笔记 |文件系统
    561. 数组拆分 I
    620. 有趣的电影
  • 原文地址:https://www.cnblogs.com/baoconghui/p/2018969.html
Copyright © 2011-2022 走看看