Hi there, I'm trying to create a complex number class in c++ and have hit a snag. I have searched the forums here for an answer and have tried to google it, but still wasnt able to figure out what is wrong. I am fairly new to C++ so yeah. Here is the code so far, I am having troubles with overloading the == and testing it.

complex.h

```
#ifndef COMPLEX_H
#define COMPLEX_H
#include <iostream>
using namespace std;
class Complex
{
// Data Members
private:
double real; // x and y are real numbers
double imag; // the form of the complex number is c = x + iy and i^2 = -1
// Methods
public:
// Constructors
Complex() {real = 0; imag = 1;};
// Default constructor
// Post: An instance of Complex has been created and initialized to (0 + i0 = 0).
Complex(const Complex& c);
// Copy Constructor
// Post: An instance of fraction has been created and initialized with an
// exact copy of 'f'.
// Note: This provides the mechanism for the assignment operation and for
// passing of parameters.
Complex(double x, double y ) {real = x; imag = y;};
// Complex Number Constructor
// Post: An instance of complex has been created that has the same value
// as double x and double y.
// Mutators
double getReal() {return real;};
// Post: The x from the calling instance has been returned.
double getImag() {return imag;};
// Post: The y from the calling instance has been returned.
void setReal(double x) {real = x;};
// Pre: 'x' is a double;
// Post: The x from the calling instance has been set to 'x'.
void setImag(double y) {imag = y;};
// Pre: 'y' is a double;
// Post: The y from the calling instance has been set to 'y'.
double getNorm();
//Pre: a real and imaginary number must be given.
//Post: the norm "sqrt(real^2 + imaginary^2)" is returned.
bool operator == (Complex& check);
//Post The boolean value of "this == check" has been returned.
//bool operator > (const Complex& b);
```

complex.cpp

```
#include "complex.h"
#include <cmath>
// Implementation of the member functions
Complex::Complex(const Complex& c)
{
real = c.real;
imag = c.imag;
}
double Complex::getNorm()
{
// Find the Greatest Common Divisor of the numerator and denominator
double x = real;
double y = imag;
double norm = (x * x) + (y * y);
norm = sqrt(norm);
return norm;
}
bool Complex::operator == (Complex& check)
{
if ((real == check.getReal) && (imag == check.getImag))
return true;
else
return false;
}
```

complexTest.cpp

```
#include "complex.h"
#include <cmath>
// Implementation of the member functions
Complex::Complex(const Complex& c)
{
real = c.real;
imag = c.imag;
}
double Complex::getNorm()
{
// Find the Greatest Common Divisor of the numerator and denominator
double x = real;
double y = imag;
double norm = (x * x) + (y * y);
norm = sqrt(norm);
return norm;
}
bool Complex::operator == (Complex& check)
{
if ((real == check.getReal) && (imag == check.getImag))
return true;
else
return false;
}
```

when I run the make file I get this error

omplex.cpp: In member function ‘bool Complex::operator==(Complex&)’:

complex.cpp:33:21: error: invalid use of member (did you forget the ‘&’ ?)

complex.cpp:33:48: error: invalid use of member (did you forget the ‘&’ ?)

make: *** [complex.o] Error 1