If I change it to void setOutputFormat(ostream& out, int decimal_places),
with a call by reference, it works. I don’t understand why though?
What is the difference between a struct and a class, besides struct members are by default public, and class members are by default private?
If I change it to void setOutputFormat(ostream& out, int decimal_places), with a call by
Share
You’re right that there is no difference between class and struct, except the default private vs private.
The problem here is that ostream doesn’t have a copy constructor, so you can’t pass it by value.