Please send questions to
st10@humboldt.edu .
#ifndef boa_h
#define boa_h
/*
a boa is a class
new boa(string color, double length,
string food)
...representing a boa with:
a color that is its primary coloring,
a length in meters,
a preferred food
template for a function with a boa parameter a_boa:
ret_type process_boa(boa a_boa)
{
return ... a_boa.get_color() ...
... a_boa.get_length() ...
... a_boa.get_food() ... ;
}
*/
// NEED the following if your class includes string data
#include <string>
using namespace std;
class boa
{
// you put things in the public part that
// USERS need to be able to use the boa class
// (note: we will put data fields in the private
// part rather than the public part --
// SO make sure you provide public methods
// for everything users "should" be able to
// do with the data fields...)
public:
// constructor method header
// style: we will avoid giving parameters the
// same names as data field names...
boa(string a_color, double a_length, string a_food);
// selector method headers
string get_color( ) const; // you put const for a
// method that doesn't
// change anything...
double get_length( ) const;
string get_food( ) const;
// you put things in the private part that YOU
// want or need in creating this class, or
// maintaining this class, that users are NOT
// to use directly
private:
string color;
double length;
string food;
}; // NOTE THIS SEMICOLON!! one of the few times you
// NEED one after a }
#endif