我正在努力做到这一点:
class A {
//attibutes
}
class B : A {
public int classBAttribute = 5;
// other attributes and methods
}
我的问题是,如果我有 A 类的实例,我如何获取 B 类的实例或访问他的属性?
B b = new B();
Application.Add(b);
//other form
A a = Application.GetA();
B b = getBFromA(a);// ??? Note: B b = a as B; does't work i tried