酷代码 AI
菜单
服务商

C++ 代码揭秘:打造可运行、可刹车的汽车类示例

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; } ######[AI写代码神器 | 373点数解答 | 2024-05-26 17:02:18]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]