'Use overload operators to calculate two class

Overload op +

image

Constructor

image

Supposed output:

b= + 8 * x^3 + 6 * x^2 + 4 * x + 2;
c=  + 3 * x^2         + 1;
d=  + 8 * x^3 + 9 * x^2 + 4 * x + 3

I try to use a for loop inside the overload function + to add the two Polynomial classes up. But the overload function does not work.

The d is supposed to be a function that b and c add up to.

image



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source