错误:
无效的表达式术语'string'
构造
public Car(string make, string model, int condition, double price, int passenger)
:base(string make, model, condition, price)
答案 0 :(得分:7)
问题:在向base class
构造函数发送参数时,您不需要使用datatype
。
解决方案:从string
参数base()
make
试试这个:
public Car(string make, string model, int condition, double price, int passenger )
:base(make, model, condition, price)
答案 1 :(得分:2)
public Car(string make, string model, int condition, double price, int passenger )
:base(make, model, condition, price)
只需删除“字符串” - 您正在调用类似普通函数的构造函数,因此您不需要关键字字符串