关于强类型转换的问题
我定义了2个类,一个TextQuestion,一个Question,TextQuestion继承与Question
现在我想将Question强类型转换成为TextQuestion,结果出错。
不知道什么原因?请高手赐教。
public class Question
{
private string _companyNo;
public string CompanyNo
{
get
{
return _companyNo;
}
set
{
_companyNo = value;
}
}
private string _invId;
public string InvId
{
get
{
return _invId;
}
set
{
_invId = value;
}
}
private short _invQustId;
public short InvQustId
{
get
{
return _invQustId;
}
set
{
_invQustId = value;
}
}
private string _invQustText;
public string InvQustText
{
get
{
return _invQustText;
}
set
{
_invQustText = value;
}
}
private short _invQustTypeCd;
public short InvQustTypeCd
{
get
{
return _invQustTypeCd;
}
set
{
_invQustTypeCd = value;
}
}
private bool _invQustMust;
public bool InvQustMust
{
get
{
return _invQustMust;
}
set
{
_invQustMust = value;
}
}
public Question()
{
}
}
public class TextQuestion : Question
{
}