I need help with the operator+ function. Please provide code and some comments s
ID: 3539302 • Letter: I
Question
I need help with the operator+ function. Please provide code and some comments so I can understand the flow. The add_assign (operator+=) is already created and works fine.
BigInt operator+(const BigInt&, const BigInt&)
{
//The BigInt object which the function is called on does not have its value changed (no side effect). Create a BigInt object that is //a copy of the left operand object. To the created BigInt object add the value of the parameter, use add_assign. Return the //BigInt object that was created.
return *this;
}
Explanation / Answer
BigInt operator+(const BigInt& num1, const BigInt& num2)
{
BigInt sum = num1;
sum += num2;
return sum;
}