zoukankan      html  css  js  c++  java
  • C#的protected internal

    关于C#的protected internal,也许你在网上可以找到两种解释:


    第一种解释是,protected or internal ,即在本程序集或其他程序集继承的子类可以访问。

    第二种解释是,protected and internal,即在本类或本程序集继承的子类可以访问。



    这需要判断protected  internal 是何种解释,就要从微软的MSDN中得到答案。


    摘要原文:

    protected internal


    The type or member can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly. Access from another assembly must take place within a class declaration that derives from the class in which the protected internal element is declared, and it must take place through an instance of the derived class type.


    译文:

    该类型或成员可以在声明的程序集的程序集中的任何代码或在另一个程序集内的派生类中访问。从另一个程序集的访问必须发生在一个类声明中,该类声明中声明受保护的内部元素的类,它必须通过派生类类型的实例发生。



    微软开发者:


    protected internal


    由其声明的程序集或另一个程序集派生的类中任何代码都可访问的类型或成员。 从另一个程序集进行访问必须在类声明中发生,该类声明派生自其中声明受保护的内部元素的类,并且必须通过派生的类类型的实例发生。


    所以,protected  internal 是本程序集其他程序集继承的子类可以访问。

  • 相关阅读:
    LVM磁盘逻辑卷扩容
    confluence 搭建总结
    GTX1050ti安装tensorflow2.0(gpu)
    sublime text 配置 markdown和预览
    Python 程序打包成 exe 可执行文件
    devc++ 配置openCV
    Ubuntu安装sublime text3
    sublime text 配置Miniconda编译环境
    sublime text 配置devc++ 编译环境
    2013-03-27 problem2 A Famous ICPC Team
  • 原文地址:https://www.cnblogs.com/maokun/p/6710815.html
Copyright © 2011-2022 走看看