gpt4 book ai didi

.net - .NET 中的 "protected"和 "protected internal"修饰符有什么区别?

转载 作者:行者123 更新时间:2023-12-03 18:18:43 25 4
gpt4 key购买 nike

.NET 中的“ protected ”和“ protected 内部”修饰符有什么区别?

最佳答案

私有(private)

Access is only allowed from within a specific type



protected

private access is expanded to include inheriting types



内部

private access is expanded to include other types in the same assembly



所以它遵循:

protected 内部

private access is expanded to allow access for types that either inherit from or are in the same assembly as this type, or both.



基本上,将所有内容视为 private首先,以及您认为在此基础上扩展的任何其他内容。

关于.net - .NET 中的 "protected"和 "protected internal"修饰符有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/889076/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com