#include <dog.h>
Public Member Functions | |
Dog () | |
Dog (string name, double age) throw ( out_of_range ) | |
double | getDogYears () const |
virtual void | print (ostream &out=cout) const |
virtual void | read (istream &in) throw ( out_of_range ) |
Dog::Dog | ( | ) |
Default constructor.
Dog::Dog | ( | string | name, | |
double | age | |||
) | throw ( out_of_range ) |
Explicit class constructor that initializes this pet object with 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 |
double Dog::getDogYears | ( | ) | const |
Returns this dog's age in so-called dog years, using the rule of thumb that seven dog years equals one human year.
void Dog::print | ( | ostream & | out = cout |
) | const [virtual] |
Prints this pet's width to the ostream out, which defaults to cout.
out | an ostream for printing (defaults to cout) |
Reimplemented from Pet.
void Dog::read | ( | istream & | in | ) | throw ( out_of_range ) [virtual] |
Reads this pet's characteristics from the ifstream argument, storing them in the respective data members.
in | an istream for reading |
out_of_range | if the age is out of range |
Reimplemented from Pet.