car::car(int seats, string color, string type, int power, string name):vehicle(name){ this->seats = seats; this->color = color; this->type = type; this->power = power; } void car::break(){ cout<<"刹车"<<endl; } void car::display(){ cout<<"车名:" << getname()<<endl; cout<<"座位数:" <<seats<<endl; cout<<"颜色:" <<color<<endl; cout<<"类型:" <<type<<endl; cout<<"功率:" <<power<<endl; } int main(){ car c1(5,"Red","Sedan",200,"Honda Civic"); c1.display(); c1.run(); c1.break(); return 0; } [2024-05-26 17:02:18 | 酷代码 | 373字解答]