#include #include #define call class animal { int pv1; float pv2; protected: int pt1[5]; public: animal(int); float pb1; int pb2[9]; void talk(void); }; animal::animal(int x=38){ pv1=x; pv2=45.67; this->pb1=135.246; for (int i=0; i<9; i++) pb2[i]=i+1; //pb2={ 1,2,3,4,5,6,7 ,8,9}; cout<<" Animal shows up\n"; }; void animal::talk(void) { cout << " animal talk, pv1=" << dec <pv3 << " is dying \n"; } void mankind::talk(void) { // cout << " mankind talk, pv1=" << pv1 <<"\n"; // cout << " mankind talk, pb2=" << pb2 <<"\n"; // cout << " mankind talk, pb2=" << animal::pb2 <<"\n"; cout << " mankind talk, pb2[0]=" << pb2[0] <<"\n"; cout << " mankind talk, pv3=" << pv3 <<"\n"; cout << " mankind talk, pb3[3]=" << pb3[3] <<"\n"; }; animal aa1(123),aa2(456); mankind * mm1, *mm2; void onlyasub(void) { mankind nobody; cout << " Now in routine onlyasub\n"; } main(){ aa1.talk(); cout << "Welcome to C++\n"; call onlyasub(); mm1= new mankind("Chang-3"); mm2= new mankind("Lee-4"); cout << "mm1->pb1=" << mm1->pb1 << "\n"; cout << " (Let mm1 talk)\n"; mm1->talk(); delete mm2; cout << " (and then Let mm1 talk by animal method)\n"; mm1->animal::talk(); return(0); }