structs in C++ are just like classes except the members are all public by default. Therefore in main() I would declare an instance of candybar called def like this:

candybar def;

without the function body after it. The above line uses the default default constructor provided by the compiler to set aside memory for def. The data members in def are undefined. To give the "default" values you want you have to use the set() function or set up a default constructor for candybar struct/class.

set(def, "none", 0.0, 0);

then you can change the default values you put in by doing:

set(def);

which will use the default arguments in set(). Call the show function after each call to set() to see if it works.

...or use vVv's technique.

03-22-2002

rippascal

working

here is a copy of the working code
thanks for the help
[code]
// reference prblm. 2 pg368 c++ primer plus
#include <iostream>
using namespace std;