小编Dav*_*n89的帖子

"类不包含带0参数的构造函数"

我很困惑为什么这不会运行.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    class Buyer : User
    {
        public void AuctionWon()
        {
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我得到"不包含带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;
    }
}
Run Code Online (Sandbox Code Playgroud)

c# oop

-1
推荐指数
1
解决办法
1397
查看次数

标签 统计

c# ×1

oop ×1