zoukankan      html  css  js  c++  java
  • 访问修饰符(C# 编程指南)(链接)

    下面这篇微软官方文档,介绍了C#中的publicprivateprotectedinternal等访问修饰符:

    Access Modifiers (C# Programming Guide)

    文档中有两个地方,这里特别强调下:

    Classes and structs declared directly within a namespace (in other words, that aren't nested within other classes or structs) can be either public or internal. Internal is the default if no access modifier is specified.

    也就是说,在命名空间下的一个类或结构体,如果没有声明访问修饰符,那么类或结构体的默认访问修饰符就是internal

    Class and struct members, including nested classes and structs, have private access by default.

    也就是说,在类或结构体中定义的成员(包括字段、属性、方法、嵌套的类或结构体等),如果没有声明访问修饰符,那么成员的默认访问修饰符就是private

  • 相关阅读:
    控制流程
    表达式
    2020.2.7
    寒假自学进度六
    2020.2.6
    2020.2.5
    寒假自学进度五
    Scala初级实验
    寒假自学进度四
    Spark运行基本流程
  • 原文地址:https://www.cnblogs.com/OpenCoder/p/12751670.html
Copyright © 2011-2022 走看看