I have this code:
#include <time.h>
class ElapsedTime
{
time_t _startTime;
public:
ElapsedTime(void){
time(&_startTime);
}
double MiliSecond()
{
time_t endTime;
time(&endTime);
return difftime(_startTime,endTime) * 1000;
}
~ElapsedTime(void);
};
and I used it inside my c++ code. It compiles but generate error during linking as the linker says it can not find the elapsetime definition.
How can I define a class completely in an H file? For this simple class, I don't want to have a .h and a .cpp.