// file: lecture_29/t_00.cc // // system include files // #include "t.h" // initialize static consts // Toaster::DEBUG Toaster::debug_level_d = Toaster::NONE; // method: set_value() // bool Toaster::set_value(const long len_a, long width_a, float weight_a) { len_d = len_a; width_d = width_a; weight_d = weight_a; if (debug_level_d == BRIEF) { fprintf(stdout, "... brief debug information ...\n"); fprintf(stdout, "len_d = %d\n", len_d); } else if (debug_level_d == FULL) { fprintf(stdout, "*** full debug information ***\n"); fprintf(stdout, "len_d = %d\n", len_d); fprintf(stdout, "width_d = %d\n", width_d); } return true; } // method: display() // bool Toaster::display(FILE* fp_a, char* str_a, long val_a) { // print the contents // fprintf(fp_a, "object name: %s\n", str_a); fprintf(fp_a, "length = %d\n", len_d); fprintf(fp_a, "width = %d\n", width_d); fprintf(fp_a, "weight = %f\n", weight_d); // call status // status(fp_a); // exit gracefully // return true; } // method: status() // bool Toaster::status(FILE* fp_a) { fprintf(fp_a, "*>>> hello class\n"); return true; } // method: add() // Toaster Toaster::add(Toaster& arg1_a, Toaster& arg2_a) { Toaster tmp; len_d = arg1_a.len_d + arg2_a.len_d; return tmp; }