#include <iostream>
#include <string>
using namespace std;
class Car
{
private:
int secret;
public:
string color;
int wheel;
int id;
Car(void); //构造器
void setColor(string);
void showColor(void);
void showWheel(void);
};
Car::Car(void)
{
wheel = 4;
}
void Car::setColor(string col)
{
color = col;
}
void Car::showColor(void)
{
cout << "车的颜色为:" << color << endl;
}
void Car::showWheel(void)
{
cout << "车有" << wheel << "个轮子" << endl;
}
int main()
{
Car mycar;
mycar.id = 250;
//mycar.secret = 13; //出错
mycar.setColor("white");
mycar.showColor();
mycar.showWheel();
return 0;
}