// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 2380, Spring 2009 // Lab 8: Header file for Lab 8 // Date: January 14, 2009 // Comment: The code here is meant to be revised. // ***************************************************************** #include #include using namespace std; #ifndef LAB2380_8_HEAD_H #define LAB2380_8_HEAD_H /************************************************************* Part A: practice const data members *************************************************************/ class A { private: const int size; //a const data member char *cat; public: A(); //default constructor A(const int n); //constrcutor with parameter void print(); //print A ~A(){delete[] cat;}; //destructor }; A::A():size(100) //head initialization of size { cat = new char[size]; strcpy(cat, "I see a head initialization."); } A::A(const int n): size(n) { cat = new char[n]; if (n>50) strcpy(cat, "Meow, meow, another head initialization."); else cat[0]='\0'; } void A::print() { cout<<"size is => "<< size< " <50) strcpy(cat, "Meow, meow, another head initialization."); else cat[0]='\0'; } void B::print() { cout<<"size is => "<< size< " <