I'm trying to learn C++ programing and can't for the life of me understand what the issue is with my current task (using Visual Studio 2008).
When I try to compile, I keep getting an error "C2228: left of '.printTime' must have class/struct/union"
Here's a snipit of the code:
//in main.cpp
int main()
{
baseTime time();
time.printTime();
}
//in baseTime.h
class baseTime
{
public:
baseTime();
void printTime() {
cout << ...
private:
int h;
int m;
}
To my knowledge, my code looks exactly the same as I've seen in book, in other forums, and in the VS help file, as well as exactly like programs I've used in the past the run perfectly well. What the heck is that error talking about and how do I fix it? Any suggestions?
Tags: