如何从基类访问孩子?
我的课程设置如下:
abstract class Bank
{
public Bank(int One, int Two)
{
}
}
public class Checking : Bank
{
public Checking(int One, int Two) : base(One, Two)
{
}
}
public class Savings : Parent
{
public Savings(int One, int Two) : base(One, Two)
{
}
}
如何在需要时让 Bank 类实例化支票和储蓄?
我想做类似的事情:
Bank B = new Savings(....);
B = new Checkings(....);
B.Savings.Foo(......);
B.Checkings.Foo(.....);