【发布时间】:2016-07-18 23:56:48
【问题描述】:
假设我有一个基类:
public class A {
public float someValue;
<Access Modifier Here> float SomeValue {
get {
return someValue;
}
}
}
我想从中得到:
public class B : A {
public float SomeProperty {
get {
return SomeValue;
}
}
}
如果我想让 SomeValue 属性仅可用于派生类而不可用于其他任何地方,我会使用什么访问修饰符?
【问题讨论】:
-
protected是你要找的。span> -
只保护派生类
-
read the documentation。听起来
protected就是您要找的东西。 -
好吧@nopeflow 打败了我。
-
我喜欢人们投票关闭主要是基于意见。
标签: c#