COURSE of the MONTH

Trouble overloading operators in C++

I am working on an assignment where I need to overload the +, -, ==, =!, >> and << operators using a Complex number class. I have the + and - working, but when I try to compile with my == and =! I am getting errors. can someone tell me what I have wrong?

I'm still getting some compliation errors. What are the accessors you mentioned for? I hadn't heard of using those before? do they go in public or private? Sorry to ask so many questions I am really trying to grasp this assignment.

"Accessors" is a term used for public methods that return (or set) private values. The "Real" functions in this header are accessors. Some people like to use "Accessor" and "Modifier", where Accessors return values and Modifiers set them.

Accessor and Modifier functions are public, so that the caller can access them. They allow public access to data that would otherwise be private. The idea is that by providing accessors and modifiers, you retain control over your private data. You could, for example, require the caller to provide an access code and have the Accessor or Modifier check that code. That isn't common, I'm just using that as an example.