ostream& operator<<(ostream& out, String const& s) { ostream& out << ss; return out; } s - char *
Error: Reference to type 'std :: basic_ostream' must be initialized
How to write correctly?
ostream& operator<<(ostream& out, String const& s) { ostream& out << ss; return out; } s - char *
Error: Reference to type 'std :: basic_ostream' must be initialized
How to write correctly?
ostream& out << ss; You say: out is a link to ostream (link to which object?) This is a newly announced link, although it has the same name as the function argument. The argument in already said that this is a reference to an object of type ostream , which you pass to the function. So just use it:
out << ss; and further:
not String const& s , but const String& s
String const& corresponds to the type reading rule in C ++: a reference to a constant String. - ixSciSource: https://ru.stackoverflow.com/questions/819422/
All Articles