/**************************************************************** example 4 - animal.h super-simple class with "inline" member functions ****************************************************************/ #include <iostream> #include <string> using namespace std; class animal { private: string sound; public: animal() { sound = "<<silence>>"; } animal(const string& s) { sound = s; } void talk() { cout << sound; } void setSound(const string& s) { sound = s; } string& setSound() { return sound; } friend ostream& operator<< (ostream&, const animal&); }; ostream& operator<< (ostream& out, const animal& A) { out << A.sound; return out; }