我很困惑,爲什麼這將無法運行。「類不包含構造函數取0參數」
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Buyer : User
{
public void AuctionWon()
{
}
}
}
我得到「不包含帶0參數的構造函數」。我已經在手邊尋找幫助,但沒有結果在哪裏有幫助。
這是用戶級
public class User
{
private int accountNo;
private int password;
public User(int accountNo, int password)
{
this.accountNo = accountNo;
this.password = password;
}
public bool Validatepassword(int userpassword)
{
if (password == userpassword)
{
return true;
}
else
{
return false;
}
}
public int GetAccountNo()
{
return accountNo;
}
}
請顯示class User ... – 2013-03-18 17:24:09
由於您不在任何位置調用無參數構造函數,因此顯然您沒有向我們顯示生成錯誤的代碼。 – Servy 2013-03-18 17:24:10
[你沒有特別難搜](http://stackoverflow.com/questions/7230544/c-sharp-error-parent-does-not-contain-a-constructor-that-takes-0-arguments) – AlexFoxGill 2013-03-18 17:24:36