【发布时间】:2014-04-24 23:24:53
【问题描述】:
上述错误发生在我实现构造函数的那一行。我发表了一条指向那条线的评论。非常感谢任何帮助。
#include <vector>
#include <time.h>
class Stopwatch
{
enum state {UNSTARTED, RUNNING, PAUSED, FINISHED};
struct time
{
unsigned hours;
unsigned minutes;
unsigned seconds;
};
struct lap
{
unsigned n; // lap number
time t; // lap time
lap* next_ptr;
};
public:
Stopwatch();
~Stopwatch();
void right_button(); // corresponds to start/stop/pause
void left_button(); // corresponds to lap/reset
private:
state cur_state;
std::vector<lap> lapsvec;
}
Stopwatch::Stopwatch() // <--------- Here's where the compiler error is
{
cur_state = UNSTARTED;
}
/* trivial destructor */
Stopwatch::~Stopwatch()
{
}
int main()
{
return 0;
}
我查看了 C++ 构造函数,看看能否找出问题所在。没有运气。
【问题讨论】:
标签: c++