Cat Class Reference

#include <cat.h>

Inheritance diagram for Cat:

Pet

List of all members.

Public Member Functions

 Cat ()
 Cat (string name, double age, int lives=9) throw ( out_of_range )
void setLives (int lives) throw ( out_of_range )
int getLives () const
virtual void print (ostream &out=cout) const
virtual void read (istream &in) throw ( out_of_range )

Protected Attributes

int lives


Detailed Description

Cat class for storing information about cat, which has a certain number of lives. Derived from the Pet class, which has a name and age.

Author:
Mark Maloof
Version:
1.1, 7/21/10

Constructor & Destructor Documentation

Cat::Cat (  ) 

Default constructor.

Cat::Cat ( string  name,
double  age,
int  lives = 9 
) throw ( out_of_range )

Explicit class constructor initializing a pet object using the arguments name, age, and lives.

Parameters:
name a string storing the name of this pet
age an int storing the age of this pet
lives an int storing the lives of this pet
Exceptions:
out_of_range if age or lives is out of range


Member Function Documentation

void Cat::setLives ( int  lives  )  throw ( out_of_range )

Sets this pet's lives.

Parameters:
lives an int storing this pet's lives, which must be in {0,...,9}.
Exceptions:
out_of_range if lives if out of range

int Cat::getLives (  )  const

Returns this pet's lives.

Returns:
an int storing this pet's lives

void Cat::print ( ostream &  out = cout  )  const [virtual]

Prints this pet's lives to the ostream out, which defaults to cout.

Parameters:
out an ostream for printing (defaults to cout)

Reimplemented from Pet.

void Cat::read ( istream &  in  )  throw ( out_of_range ) [virtual]

Reads this pet's lives from the istream, storing them in the respective data members.

Parameters:
in an istream for reading
Exceptions:
out_of_range if age or lives is out of range

Reimplemented from Pet.


Member Data Documentation

int Cat::lives [protected]


The documentation for this class was generated from the following files:

Generated on Thu Jul 29 11:29:32 2010 by  doxygen 1.5.5