Hello world, first time poster here.
I'm having some trouble using Operator Overloading in a C++ project I'm working on. I've read articles and tried to understand, but I'm just not able to get my code to do what I'm trying to do.
Basically I have a header called sphere.h, in this header I have a class called sphere. This class is used to create spheres, calculate volume, etc. I successfully overloaded an operator so that I can say "sph1 = sph2" and it assigns the center coords. and radius from sph2 into sph1.
Now, I'm trying to make one so I can say "sph# = sph1+sph2" and it will apply it will add the coords. and radius together and store them in a new sphere.
Below are pastebins of my code:
sphere.h header file:
http://pastebin.com/7m0q7sNu
sphere.c++ source:
http://pastebin.com/6qs6ubJi
My code currently compiles, but I can't figure out how to use sph1 and sph2, and then assign them to sph#.
Any help would be much appreciated.
Thanks,
-Justin B.