//----------------------------------------------------------------- // Author: Zhixiang Chen // Class: CSCI/CMPE 2380, Spring 2009 // Lab 8: Const, static data members, and static methods // class member pointers // Date: January 15, 2009 // Comment: The code here is meant to be revised. // //----------------------------------------------------------------- // // This lab exercise is practice const, static data members, // and static methods class member pointers // // Compile and run your program. When everything is fine, // print your .cpp and .h files and turn them to me or the TA. // ***************************************************************** #include < iostream > #include < fstream > #include < string > #include < cstring > #include < cmath > #include < cstdlib > #include < iomanip > #include < vector > #include #include "lab2380_8_head.h" using namespace std; int main() { /****************************************************** Part A: practice a const data member ******************************************************/ cout<<"Part A: "< "; cin >> option; if (option == 1) { ptrTwo = & C:: printOne;//ptrTwo points to method printOne (fat.*ptrTwo)(20); //call printOne in bat } else { ptrTwo = & C:: printTwo;//ptrTwo points to method printOne (fat.*ptrTwo)(30); //call printTwo in bat } /******************************************************************* Part F: This part is for you. Re-define class C so that cat and dog are both private. Re-do Part F. Feel free to add more members to class C. *******************************************************************/ //complete the program return 0; }