类型转换
class
Program
{
static
void
Main(
string
[] args)
{
Father father =
new
Father();
//初始化子类对象
Son son = father
as
Son;
//把father转换成Son类型 让 son来接收
son.SonMethod();
}
}
class
Father
{
}
class
Son
: Father
{
public
void
SonMethod()
{
}
}