【发布时间】:2010-11-01 06:51:31
【问题描述】:
我在一个类中有静态变量和方法。它们会在派生类中被继承吗?
例如:
class A
{
public static int x;
public static void m1()
{
some code
}
}
class B:A
{
B b=new B();
b.m1(); // will it be correct or not, or will I have to write
// new public voim1(); or public void m1();
b.x=20; // will it be correct or not?
}
【问题讨论】:
-
你的代码很乱——特别是在
B。
标签: c# inheritance static-members