相关疑难解决方法(0)

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

似乎我得到一个错误,指出"产品不包含带0参数的构造函数

public class Products
{
    string id;
    string name;
    double price;
    int soldCount;
    int stockCount;

    public Products(string id, string name, double price, 
                      int soldCount, int stockCount, double tax)
    {
        this.id = id;
        this.name = name;
        this.price = price;
        this.soldCount = soldCount;
        this.stockCount = stockCount;
    }
}

//I have got some get and set values for the code above 
//but it would have been too long to put in here

public class FoodProducts : Products
{
    public FoodProduct()
    {
        Console.WriteLine("This is …
Run Code Online (Sandbox Code Playgroud)

inheritance c#-4.0

35
推荐指数
4
解决办法
8万
查看次数

标签 统计

c#-4.0 ×1

inheritance ×1