摘要: //成员函数指针数组//假如我们将许多成员函数指针放在一个数组中,那么这个数组就叫成员函数指针数组//该数组中的成员函数指针可以通过数组的下标来进行调用,并且可以用成员函数的内存地址来对数组的各个成员函数指针进行初始化#include <iostream>#include <string>using namespace std;class Paper{public: void read(){ cout<<"纸上面的字可以读"<<endl;} void write(){ cout<<"纸可以用来写字&quo 阅读全文
posted @ 2012-09-17 23:58 简单--生活 阅读(472) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;class Human{public: virtual void run()=0; virtual void eat()=0;};class Month:public Human{public: void run(){ cout<<"母亲跑百米要二十少"<<endl;} void eat(){ cout<<"母亲喜欢吃零食"<<endl;}};class Father:public Human{public: void 阅读全文
posted @ 2012-09-17 23:25 简单--生活 阅读(164) 评论(0) 推荐(0) 编辑
摘要: // 8 使用typedef简化函数指针的声明#include <iostream>using namespace std;//void (*p[5])(int&, int&);typedef void(*p)(float&,float&);//函数指针作为函数的参数的一般形式为:void func(void(*p)(int&,int&), int&, int&);//该函数func有三个参数,第一个参数void(*p)(int&,int&)是个函数指针,//它指向一个带有两个int型参数并且返回voi 阅读全文
posted @ 2012-09-17 00:04 简单--生活 阅读(485) 评论(0) 推荐(0) 编辑
简单--生活(CSDN)