#include<iostream>
using namespace std;
class Clock{
public:
void setTime(int newH=0,int newM=0,int newS=0);
void showTime();
private:
int hour,minute,second;
};
void Clock::setTime(int newH,int newM,int newS){
hour=newH;
minute=newM;
second=newS;
}
inline void Clock::showTime(){
cout<<hour<<":"<<minute<<":"<<second<<endl;
}
int main(){
Clock myClock;
cout<<"First time set and output:"<<endl;
myClock.setTime();
myClock.showTime();
cout<<"Second time set andoutput:"<<endl;
myClock.setTime(8,30,30);
myClock.showTime();
return 0;
}
用的是VC++6.0,求大神解惑
谢谢啊,重建一个CPP文件成功了!但是为什么会出现这种情况,怎么解决呢
追答是链接错误,以前VC6.0也经常发生。我一般也没管。应该是之前生成的一些东西影响了。
换个IDE吧,VS2010很好。
谢谢!