ValveTime.co.uk | Valve News, Forums, Steam

Hey guys. I'm working on a program right now that's dealing with polynomials, and my idea was to have a linked list of "term" objects that each held a coefficient and exponent int. But, of course, C++ hates me and wishes to frustrate even these simple efforts.

Code:
class Term
{
	public:
		void setCoefficient(int x) { coefficient = x; };
		void setExponent(int x) { exponent = x; } ;
		int getCoefficient( ) { return coefficient; };
		int getExponent( ) { return exponent; };
		Term( ) { coefficient = 0; exponent = 0; };
		Term(int x, int y) { coefficient = x; exponent = y; };
		Term& operator=(Term& rtSide);
	private:
		int coefficient;
		int exponent;
};

Term& Term::operator=(Term& rtSide)
{
	coefficient = rtSide.coefficient;
	exponent = rtSide.exponent;
	return *this;
}

returns this error message:
File: [dir]\TermNode.o(.text+0x0)
Message: In function 'ZN4TermaSERS_':
File: [dir]\Term.cpp
Message: [Line 17] multiple definition of 'Term::eek:perator=[Term&]'
File: [dir]\Term.o(.text+0x0):[dir]\Term.cpp
Message: [Line 17] first defined here
File: [same]
Message: [Line 17] Id returned 1 exit status
File: [dir]\Makefile.win
Message: [Build Error] [CS256Proj3.exe] Error 1

It's clearly a problem with the makefile somewhere. For reference, I'm using Dev-C++ 4.9.9.2, which uses the latest MingW32 compiler I believe.

Any ideas on what's causing this?
Back
Top