1.
template <class weightType>
class ZooAnimal
{
private:
char *name;
int cageNumber;
int weightDate;
weightType weight;
public:
ZooAnimal (char*, int, int, weightType); // constructor function
inline ~ZooAnimal () { delete [] name; }; // destructor function
void changeWeight (int pounds);
char* reptName ();
int reptWeight ();
int daysSinceLastWeighed (int today);
};
// ---------- the constructor function
template <class weightType>
ZooAnimal<weightType>::ZooAnimal (char* who, int whichCage, int weighDay,
weightType pounds)
{
char *name = new char[20];
strcpy (name, who);
cageNumber = whichCage;
weightDate = weighDay;
weight = pounds;
}
2.
template <class weightType, class cageType>
class ZooAnimal
{...};
3.
ZooAnimal<int> bozo ("Bozo", 408, 1027, 400);