I'm getting a LN2019/LN1120 error, and I have no clue why... any suggestions?

#include <iostream>
#include <string>
using namespace std;
class Time
{
public: 
	Time(int hour, int minute);
	Time();
	void setHour(int);
	void setMinute(int);
	int getHour();
	int getMinute();
	void incrHour(int);
	void incrMinute(int);
	void printTime();
protected:
	int hr, min;
};

Time::Time( int hour, int minute ) { hr = hour; min = minute; }
/////
Time::Time() { hr = min = 0; }
/////
void Time::setHour(int hour) 
{ 
	if (hour >= 0 && hour < 24)
		hr = hour;
	else
		hr = 0;	
}

void Time::setMinute(int minute)
{
	if (minute < 60 && minute >= 0)
		min = minute;
	else
		min = 0;
}

int Time::getHour() { return hr; }
int Time::getMinute() { return min; }

void Time::incrHour(int)
{
	hr++;
		if (hr == 24)
			hr = 0;
}

void Time::incrMinute(int)
{
	min++;
		if (min == 60)
		{
			hr++;
			min = 0;
			if (hr == 24)
					hr=0;
		}
}

void Time::printTime()
{
	cout << "time starts out ";
	if (hr > 24 )
		cout << "0";
	cout << hr << ":";
	if (min >= 60)
		cout << "0";
	cout << min;
}

class extTime : public Time
{
	extTime();
	extTime( int hr, int min, string tz);
	string getTimezone();
	void setTimezone(string);
	void printTime();
private:
	string tz;
};

extTime::extTime() { hr = min = 0; tz = " "; }

extTime::extTime( int hr, int min, string tz) 
{ 
	int hour, minute;
	string timeZone;
	hr = hour; 
	minute = min; 
	tz = timeZone; 
}

string extTime::getTimezone()
{ return tz; }

void extTime::setTimezone(string timeZone)
{
	tz = timeZone;
}
void extTime::printTime()
{
	cout << getHour() << ":" << getMinute() << " "; 
	getTimezone();
}

int main()
{
	return 0;
}
Comments
Yet another post where we have to pull teeth to get information.

I'm getting a LN2019/LN1120 error, and I have no clue why... any suggestions?

My guess if you did something wrong somewhere in that 100 lines of code that the compiler didn't like and it gave you a cryptic error message that no one understands because we aren't compilers.

Try posting the exact error message and the line number -- based on your post -- and maybe we'll have a better idea.


Looking back on your previous threads, the first responses have been:

What are the messages that the compiler is telling you? Learning how to interpret them is an important skill. Start with the first error. If you can't figure out what it means, post it with the line number.

What's your first problem?

You'll have better luck with some explanation, not just posting code and asking us to figure out what it does. Pinpoint as close as you can where the problem seems to be, and what the crash circumstances are.

Basically, what you have here is the same as taking your car to the mechanic, saying "Fix", and walking away.

>> Run the program, it just says there's syntax errors.

It either runs or there are syntax errors. If there are syntax errors, it won't compile, so it can't run. There could be a RUN-TIME error, but that's not a syntax error. What's the exact error message, what's the line number, and is it a run-time error or a compile error?

Why do you insist on wasting so much posting nothing and waiting around for us to ask for the information we need? You already know you need to:
1) explain the problem
2) post the error messages
3) tell us where the problems are

It seems you don't really want help, you just want to waste your own time. Please either
1) start posting real questions with enough information that you can get an answer in 1 post.
2) stop asking for help.

Edited 5 Years Ago by WaltP: n/a

This article has been dead for over six months. Start a new discussion instead.