Public Class Pharmacy
{
Public Medicament Down(Product p)
{
if(p is Medicament)
{
Medicament m = (Medicament)this;
return m;
}
return null;
}
}
Public abstract Class Product : Pharmacy
{
}
Public Class Medicament : Product
{
}
Public Class Pord : Product
{
}
答案 0 :(得分:0)
可能是因为这是指调用该代码的Pharmacy对象,并且其类型应为“ Pharmacy”,而不是“药剂”。这样,您只能向上投射。看看c#中的“向下转换/向上转换”