C++ Error: No match for operator=

C++ Error: No match for operator=

Thats because yieldCurve[i] is of type Treasury, and new Treasury(treasuries[i]); is a pointer to a Treasury object. So you have a type mismatch.

Try changing this line:

yieldCurve[i] = new Treasury(treasuries[i]);

to this:

yieldCurve[i] = Treasury(treasuries[i]);
    Treasury* yieldCurve;

yieldCurve is a pointer to an array of Treasury, not Treasury*. Drop the new at the line with error, or modify the declaration for it to be an array of pointers.

C++ Error: No match for operator=

Leave a Reply

Your email address will not be published.