我的基类是:
class Base
{
public int A;
public int ShowA()
{
Console.WriteLine(A);
}
}
我有一个衍生阶级:
class Derived : Base
{
public Derived()
{
A = 5;
}
}
I use a GUI editor that shows all fields for a class. Because Derived
sets A
in its constructor I don t want it to show in the editor. The editor doesn t fields the have [HideInInspector()]
attribute.
How can I make Derived
have its A
property with [HideInInspector()]
attributes while Base
won t?
I can t use keyword new
because I want the Base
still to use the same field as Derived
in its functions (e.g. (new Derived()).ShowA()
will print 5
).
Edit: 它对财产的trick和new
股本的编辑用<条码>新条码>对田地进行两次处理(基数一次,衍生)。