构造函数中的这个color:"黑";的作用是什么啊?(各位大神帮忙看一下)
#include<iostream>
using namespace std;
class Car
{
public:
Car();
Car(string c);
void run();
private:
string color;
};
Car::Car()
{
color:"黑";
cout<<""<<endl;
}
Car::Car(string c)
{
color=c;
cout<<color<<endl;
}
void Car::run()
{
cout<<color<<endl;
}
int main()
{
Car c1("红");
Car c2("黑");
Car c3;
c1.run();
c2.run();
c3.run();
return 0;
}