Like the title said, i'm trying to implement an operator^(int n) which will calculate a complex number to the nth power. I know that this is a pointer that point to the current class object so i came up with this code:
    class Complex{
    protected:
      float a,b;
    public:
      Complex() {a=0;b=0;}
      Complex(float x, float y){a=x;b=y;}
      void set(float x, float y){a=x;b=y;}
      Complex operator*(Complex C){
                Complex temp;
                temp.a=a*C.a-b*C.b;
                temp.b=a*C.b+b*C.a;
                return temp;
      }
      Complex operator^(int n){
                Complex ONE=Complex(1,0);
                if (n<=0) return ONE;
                return ((*this)*((*this)^(n-1)));
      }
      void Display(){
                cout<<a<<' '<<b<<endl;
      }
      };
      int main() {
          Complex C;
          C.set(2,0);
          C=C^3;
          C.Display();
      }
The C.Display() is supposed to print 8 0 but when i ran in eclipse it display 2 0. Please tell me why this happens. Also really appreciate if anyone could tell me how to make ONE at line 15 a constant class object like BigInteger.ONE in Java.
 
     
     
    