44(function pointer 2)
2024-10-14 12:49:22
#include<iostream>
using namespace std; class A
{
public:
int x;
int sayhello()
{
cout<<"hello world"<<endl;
}
}; class B:public A
{ }; typedef int A::*int_pointer;
typedef int (A::*FP)(); int main()
{
int A::*pointer1 = &A::x;
int_pointer pointer2 = &A::x;
A a;
a.*pointer1 = ;
++(a.*pointer2);
cout << &a->*pointer1 << endl; B b;
a.sayhello();
int (A::*classAfunctionpointer1)();
classAfunctionpointer1 = &A::sayhello;
FP classAfunctionpointer2 = &A::sayhello;
(a.*classAfunctionpointer1)();
(a.*classAfunctionpointer2)();
(&a->*classAfunctionpointer1)();
(b.*classAfunctionpointer1)(); return ;
}
最新文章
- MVC Core 网站开发(Ninesky) 2.1、栏目的前台显示(补充)
- 【单页应用巨坑之History】细数History带给单页应用的噩梦
- js的this和面向对象编程
- 我的第一节Android课
- Chrome浏览器插件推荐大全
- 转:DataTable的Compute方法的应用
- 说不尽的MVVM(5) - 消息满天飞
- 斜堆(二)之 C++的实现
- 让你的linux操作系统更加安全【转】
- 聚簇(Cluster)和聚簇表(Cluster Table)
- Windows10输入法的切换
- CSS3 keyframes动画实现弹跳效果
- 转载:struts2和spring的结合原理(精品)
- Hbase Region Server 启动失败
- CHM木马
- MyBatis和SpringMVC集成事务在Junit测试下有效但是在实际项目无效的问题
- 转:Loadrunner学习知多少--脚本录制下载操作
- 如何在README.md文件中添加图片
- Cocos2Dv3.4在AppDelegate中不返回的情况及解决
- Django 之 流程和命令行工具