Ich habe eine Struktur bekam, die wie folgt aussieht:'std :: ios_base :: ios_base (const std :: ios_base &)' ist privat‘Fehler beim Überladen von Operatoren << für std :: ostram
sturct person
{
string surname;
person(string n) : surname(n) {};
}
Ich muss operator<<
für std::ostream
und person
überladen. Ich schrieb diese Funktion:
std::ostream operator<<(std::ostream & s, person & os)
{
s << os.surname;
return s;
}
aber ich erhalte diese Fehler:
/usr/include/c++/4.6/bits/ios_base.h|788|error: ‘std::ios_base::ios_base(const std::ios_base&)’ is private|
/usr/include/c++/4.6/bits/basic_ios.h|64|error: within this context
/usr/include/c++/4.6/ostream|57|note: synthesized method ‘std::basic_ios::basic_ios(const std::basic_ios&)’ first required here |
Vielen Dank für das, half mir aus :) +1 – T3CHN0CR4T