2 回答

TA貢獻(xiàn)1794條經(jīng)驗(yàn) 獲得超8個贊
是你寫錯字符了哈。
你在接口中是這樣定義的:
public interface IBank
{
void PayIn(float count);//注意:PayIn
bool withdraw(float count);
float Transfercount{get;}
}
而你在類中是這樣寫的:
public class CurrentAccount:ITransferBankAccount
{
private float balance;
public void PanIn(float amount)//顯然不能繼承了
//改成 PayIn就正確了
{
balance += amount;
}
.....
}
由于接口的內(nèi)部結(jié)構(gòu)不一樣,所以就不能繼承了噻。
但是你的程序應(yīng)該還有問題:
public override string ToString()
{
return string.Format("當(dāng)前賬目結(jié)余={0,6:c}", balance);
}
你看看是不是格式的轉(zhuǎn)換上有問題。

TA貢獻(xiàn)1963條經(jīng)驗(yàn) 獲得超6個贊
錯誤 1
“interfaceExample .CurrentAccount”不會實(shí)現(xiàn)接口成員“interfaceExample .IBank.PayIn(float)”
- 2 回答
- 0 關(guān)注
- 331 瀏覽
添加回答
舉報(bào)