text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

Ball406.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include "Ball406.h"
00003 
00004 using namespace std;
00005 
00006 Ball::Ball() : Sphere()
00007 {
00008    setName("");
00009 }  // end default constructor
00010 
00011 Ball::Ball(double initialRadius,
00012            const string& initialName)
00013            : Sphere(initialRadius)
00014 {
00015    setName(initialName);
00016 }  // end constructor
00017 
00018 void Ball::getName(string& currentName) const
00019 {
00020    currentName = theName;
00021 }  // end getName
00022 
00023 void Ball::setName(const string& newName)
00024 {
00025    theName = newName;
00026 }  // end setName
00027 
00028 void Ball::resetBall(double newRadius,
00029                      const string& newName)
00030 {
00031    setRadius(newRadius);
00032    setName(newName);
00033 }  // end resetBall
00034 
00035 double Ball::getArea() const
00036 {
00037    double r = getRadius();
00038    return PI * r * r;
00039 }  // end getArea

Generated on Sun Aug 27 20:00:05 2006 for AWLogo by  doxygen 1.4.6