class Complex{
    int x,y;
    
    public:
    
    void setdata(int x,int y)
    {
        this->x=x;this->y=y;
    }
    Complex add(Complex &c)
    {
        Complex temp;
        temp.x=this->x + c.x;
        temp.y=this->y + c.y;
        return temp; 
    }
    Complex(Complex &c) // copy constructor
    {
        x=c.x; y=c.y;
    }
    Complex() // Simple default constructor
    {
    }
    void showdata()
    {cout<< this->x <<" "<< this->y;}
};
int main()
{
    Complex c1; c1.setdata(3,4);
    Complex c2=c1; 
    Complex c3 = c1.add(c2);
    //c3.showdata();
    cout<<"\n"<<Complex::v;
    return 0;
}
Complex c2=c1; This is fine with compiler.
while Complex c3 = c1.add(c2); creates errors namely:
- class Complexhas no suitable copy constructor.
- cannot bind non-const lvalue reference of type Complex &to an rvalue of typeComplex.
Is this related to memory being released after the temp variable is destroyed or something else as i am not able to understand the errors prescribed by Compiler as mentioned above?
 
     
     
    