![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
Ball.cppGo to the documentation of this file.00001 00015 Ball::Ball() : Sphere() 00016 { 00017 setName(""); 00018 } // end default constructor 00019 00020 Ball::Ball(double initialRadius, 00021 const string& initialName) 00022 : Sphere(initialRadius) 00023 { 00024 setName(initialName); 00025 } // end constructor 00026 00027 void Ball::getName(string& currentName) const 00028 { 00029 currentName = theName; 00030 } // end getName 00031 00032 void Ball::setName(const string& newName) 00033 { 00034 theName = newName; 00035 } // end setName 00036 00037 void Ball::resetBall(double newRadius, 00038 const string& newName) 00039 { 00040 setRadius(newRadius); 00041 setName(newName); 00042 } // end resetBall 00043 00044 void Ball::displayStatistics() const 00045 { 00046 cout << "Statistics for a " << theName << ":"; 00047 Sphere::displayStatistics(); 00048 } // end displayStatistics |