Please send questions to
st10@humboldt.edu .
CS 131 - 10 am Lab - Week 9 Lab
* you CAN compile a C++ class using funct_compile --
this will check for syntax errors in your class
definition and implementation;
(give the class name where it asks for the function to
be compiled)
* you CAN use a dynamically-declared instance for testing
within funct_compile, then (using -> with the method
name to call the method...)
* BUT you also are expected to write a function testing
each new class, that calls all of its constructors
and tests all of its methods;
name it: <class>_test,
and see boa_test.cpp and boa_test.h for an example
* note that boa_test is going to create an example boa,
and produce whether all of its selectors produce
the expected values for its data fields --
boa_test needs NO parameters!
...put the special C++ keyword void in its signature;
* signature: boa_test: void -> bool
* now: for an example of a function that uses a boa
(that has a boa parameter),
see is_boa_portable function
is_boa_portable
signature: is_boa_portable: boa double -> bool
purpose: expects a boa and a carrier's length in meters,
and produces whether the boa could fit in a
carrier of that size
bool is_boa_portable(boa a_boa, double carrier_len)
Examples:
is_boa_portable( *(new boa("green", 12, "lasagna")), 2) == false
is_boa_portable( *(new boa("green", 12, "lasagna")), 22) == true
is_boa_portable( *(new boa("green", 12, "lasagna")), 12) == true
bool is_boa_portable(boa a_boa, double carrier_len)
{
return a_boa.get_length() <= carrier_len;
}
* (then, lab exercise)