I have created a class "Clock". I'm following from an example out of my book, and everything compiles fine except for one thing, the header file at the top. I'm confused on what a header file is. I wrote "Clock.h" because that's what the books example is. The error I'm getting says "Clock.h file not found". Do I need to save just the clock class in a different file, and have my main method in a totally different file too? Thanks.
Just like how functions need to be declared before their use, so do classes. Clock.h would include the class declaration. It probably looks like this:
1 2 3 4 5 6 7 8 9
void set (unsignedlong t = 0);
However if you add that you'd get an error as the set (unsigned long t=0) cannot be done twice. The class below looks like it was written for a header so it's better in this case to just cut and paste that into your header.