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

  • 相关阅读:
    第三周课程总结实验报告
    Java第二周学习总结
    2019春总结作业
    第十二周作业
    第十一周作业
    第十周作业
    第九周作业
    第八周作业
    第二周课程总结
    2019春总结
  • 原文地址:https://www.cnblogs.com/OpenCoder/p/12751670.html
Copyright © 2011-2022 走看看