在我从 main.cpp 文件中取出这个类并将其分解为。还有。编译器开始抱怨我在 void 中使用的默认参数。
/* PBASE.H */
class pBase : public sf::Thread {
private:
bool Running;
public:
sf::Mutex Mutex;
WORD OriginalColor;
pBase(){
Launch();
Running = true;
OriginalColor = 0x7;
}
void progressBar(int , int);
bool key_pressed();
void setColor( int );
void setTitle( LPCWSTR );
bool test_connection(){
if(Running == false){
return 0;
}
else{
return 1;
}
return 0;
}
void Stop(){
Running = false;
if(Running == false) Wait();
}
};
/* PBASE.CPP */
// ... other stuff above
void pBase::setColor( int _color = -1){
if(_color == -1){
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ),FOREGROUND_INTENSITY | OriginalColor);
return;
}
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ),FOREGROUND_INTENSITY | _color);
}
这个错误,取自 VC2010
错误4错误 C2572: ‘ pBase: : setColor’: 重新定义默认参数: 参数1