1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
   | class Dog { private: 	double weight, age; public: 	Dog(double weight = 0, double age = 0) :weight(weight), age(age) {}; 	void setWeight(double w) { weight = w; } 	void setAge(double a) { age = a; } 	double getWeight() { return weight; } 	double getAge() { return age; } }; ostream& operator <<(ostream &out, Dog& dog) { 	out << dog.getWeight() << ' ' << dog.getAge(); 	return out; } istream& operator >>(istream &in, Dog &dog) { 	double w, a; 	in >> w >> a; 	dog.setWeight(w); 	dog.setAge(a); 	return in; }
  |