vehicle::vehicle(int wheels1,float weight1) //(1分) {
wheels=wheels1; weight=weight1; }
int vehicle::get_wheels() {
return wheels; }
float vehicle::get_weight() {
return weight; }
void vehicle::show() (1分) {
cout << \车轮:\个\ cout << \重量:\公斤\ }
car::car(int wheels, float weight,
int passengers) :vehicle(wheels, weight) {
passenger_load=passengers; }
int car::get_passengers () {
return passenger_load; }
void car::show() {
cout <<\车型:小车\ vehicle::show();
cout << \载人:\人\ cout << endl; }
void main () {
car car1(4,2000,5); (1分) cout << \输出结果\ car1. show (); (1分) }
系名____________班级____________姓名____________学号____________ 密封线内不答题 ——第9页——
相关推荐: