#include <pet.h>
Public Member Functions | |
Pet () | |
Pet (string name, double age) throw ( out_of_range ) | |
void | setName (string name) |
void | setAge (double age) throw ( out_of_range ) |
string | getName () const |
double | getAge () const |
virtual void | print (ostream &out=cout) const |
virtual void | read (istream &in) throw ( out_of_range ) |
virtual | ~Pet () |
Protected Attributes | |
string | name |
double | age |
Pet::Pet | ( | ) |
Default constructor.
Pet::Pet | ( | string | name, | |
double | age | |||
) | throw ( out_of_range ) |
Explicit class constructor initializing a pet object using the arguments name and age.
name | a string storing the name of this pet | |
age | a double storing the age of this pet |
out_of_range | if the age is out of range |
Pet::~Pet | ( | ) | [virtual] |
Destructor. Does nothing but is recommended for classes with virtual methods.
void Pet::setName | ( | string | name | ) |
Sets this pet's name
name | a string storing this pet's name |
void Pet::setAge | ( | double | age | ) | throw ( out_of_range ) |
Sets this pet's age
age | a double storing this pet's age |
string Pet::getName | ( | ) | const |
Returns this pet's name
double Pet::getAge | ( | ) | const |
Returns this pet's age
void Pet::print | ( | ostream & | out = cout |
) | const [virtual] |
void Pet::read | ( | istream & | in | ) | throw ( out_of_range ) [virtual] |
string Pet::name [protected] |
double Pet::age [protected] |