![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
Ball414.hGo to the documentation of this file.00001 00015 class Sphere 00016 { 00017 public: 00018 // constructors and operations as before 00019 00020 friend void readSphereData(Sphere& s); 00021 friend void writeSphereData(Sphere& s); 00022 private: 00023 double theRadius; // the sphere's radius 00024 }; // end Sphere 00025 00026 class Ball : public Sphere 00027 { 00028 public: 00029 Ball(); 00030 Ball(double initialRadius, 00031 const string initialName); 00032 void getName(string& currentName) const; 00033 void setName(const string& newName); 00034 void resetBall(double newRadius, 00035 const string newName); 00036 void displayStatistics() const; 00037 private: 00038 string theName; // the ball's name 00039 }; // end Ball |