C# 无效的表达式项';字符串';
错误: 无效的表达式术语“字符串” 建造商:C# 无效的表达式项';字符串';,c#,constructor,C#,Constructor,错误: 无效的表达式术语“字符串” 建造商: public Car(string make, string model, int condition, double price, int passenger) :base(string make, model, condition, price) 问题:向基类构造函数发送参数时,不需要使用数据类型 解决方案:从base()中删除string参数make 试试这个: public Car(string make, string model,
public Car(string make, string model, int condition, double price, int passenger)
:base(string make, model, condition, price)
问题:向
基类构造函数发送参数时,不需要使用数据类型
解决方案:从base()中删除string
参数make
试试这个:
public Car(string make, string model, int condition, double price, int passenger )
:base(make, model, condition, price)
只需删除“字符串”-您像调用普通函数一样调用构造函数,因此不需要关键字字符串
public Car(string make, string model, int condition, double price, int passenger )
:base(make, model, condition, price)