不存在从“”转换到“”的适当构造函数

不存在从“”转换到“”的适当构造函数

问题描述:

#pragma once
#include<iostream>
using namespace std;

class Complex
{
private:
    double real, image;
public:
    Complex(double x,double y)
    {
        real = x;
        image = y;
    }

    Complex(Complex& c)
    {
        real = c.real;
        image = c.image;
    }

    Complex()
    {
        real = 0;
        image = 0;
    }

    void Show()
    {
        cout << real << "+" <<
             image << "i" << endl;
    }
    friend Complex operator + 
        (Complex c1, Complex c2);
};

Complex operator + (Complex c1,Complex c2)
{
    Complex result ();//从这一段开始下面的result就报错了
    result.real = c1.real + c2.real;
    result.image = c1.image + c2.image;
    return result;
}

Complex result ();把result后面的括号去掉