The "Complex" Class

The design of your Complex class is as follows:

The Complex class will represent mathematical complex numbers. The file Complex.h contains the definiton of the Complex class. The private data members have already been provided to you. Your Complex.cpp should consist of following:
  1. Constructor: the constructor for the Complex class should accept the real and imaginary parts of a complex number and store them in the appropriate data members. (provided to you)
  2. GetReal( ): an accessor that returns the real part of the complex number. (provided to you)
  3. GetImaginary( ): an accessor that returns the imaginary part of the complex number. (provided to you)
  4. operator +( ) function: adds two complex numbers and returns the result. Since addition of two complex numbers is also a complex number, it returns an object of type Complex. Further detailed in a later section
  5. operator -( ) function: negates the real and imaginary parts and returns the result. Since negation of a complex number is also a complex number, it returns an object of type complex. Further detailed in a later section
In addition to the above, the code for overloading the insertion operator << must also be written in Complex.cpp. However, it is not part of the Complex class and is a non-member function. Refer to the details of that step for more information.