Syntax error with my Operator Overloading.

I'm new to C++, but I can't find the mistake in my syntax. I've cut a lot of code to make it easier to read. It's from an assignment, so I can't change what's in the Date.h


Date.h
1
2
3
4
5
6
7
8
9
10
11
...
class Date {
public:
	bool operator== (const Date & other) const;
}
private:

	unsigned int month;
	unsigned int day;
}
...


Date.cpp
1
2
3
4
5
6
#include "Date.h"

bool Date::operator==(Date & other)
{
	return true; //obviously going to add code here
}


I'm using Eclipse and it says "Member declaration not found". I've looked at some examples online, but I can't find what I'm doing wrong.

Thank you!




Last edited on
You forgot const when defining the function.

1
2
3
4
bool Date::operator==(const Date & other) const
{
	return true;
}
Topic archived. No new replies allowed.