44(function pointer 2)
#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 ;
}

44(function pointer 2)的更多相关文章
- C 函数与指针(function & pointer)
C 函数与指针(function & pointer) /* * function.c * 函数在C中的使用 * */ #include <stdio.h> int noswap( ...
- 类非静态成员的函数指针 的使用 Function pointer of a non-static member function of a class
you can get the pointer of the method, but it has to be called with an object typedef void (T::*Meth ...
- tips~function pointer
An simple example: #include<stdio.h> int plus(int a,int b) { return a+b; } int main() { int (* ...
- Function Pointer in Delpni
program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; type TVoice = function(): Stri ...
- 指向函数的指针 ------ 函数指针(function pointer)
函数指针: 指向函数的指针, 首先是一个指针, 这个指针指向一个函数. 函数具有可赋值给指针的物理内存地址,一个函数的函数名就是一个指针,它指向函数的代码.一个函数的地址是该函数的进入点,也是调用函数 ...
- 43(function pointer 1)
#include<iostream> using namespace std; typedef int A; typedef void (*PF)(); typedef int (*P_A ...
- C++ function pointer and type cast
http://www.cprogramming.com/tutorial/function-pointers.html http://www.cplusplus.com/doc/tutorial/ty ...
- 指针函数(Pointer Function)和函数指针(Pointer to Function或Function Pointer)
一.指针函数 1.解释:指针函数很好理解:简单来说,就是一个返回指针的函数,本质是一个函数.如: int fun(int x,int y); //这是一个普通函数的声明,返回值是一个int类型, ...
- Using a Comparison Function for the Key Type
(这是C++系列随笔的第二篇,这一系列是我练习C++而查的资料) C++ Primer 5th. Ed. pp. 425 ---------------------- Using a Comparis ...
随机推荐
- STL源码剖析—顺序容器
一.vector 1.vector简介: vector的数据安排及其操作方式与数组非常相似,微小的差别在于空间的使用,数组是静态空间,一旦配置了就不能改变.vector是动态空间,随着元素的加入,它的 ...
- iOS - 转场时 appear 与 disappear 的调用顺序探索
不同的转场方式 A.B viewDidDisappear调用的流程不同 在A页面跳转到B页面的过程中 A 的 viewDidDisappear 方法和 B 的 viewDidAppear 谁先调用? ...
- iOS - App Extension 整体总结
一.App Extension的介绍 App Extension可以让你扩展你APP的自定义功能和内容,使用户可以在与其他应用或者系统进行互动的时候去使用它.app extension即为本文所说的e ...
- angular-file-upload+struts的使用
参考帖子 http://www.cnblogs.com/wangzun/p/6099884.html http://www.cnblogs.com/highriver/archive/2011/06/ ...
- 【Java知识点专项练习】之 数据类型两大类
Java的数据类型分为两大类:基本类型和引用类型: 基本类型只能保存一些常量数据,引用类型除了可以保存数据,还能提供操作这些数据的功能: 为了操作基本类型的数据,java也对它们进行了封装, 得到八个 ...
- 【Java知识点专项练习】之 接口和抽象类的区别
接口和抽象类的区别 接口(interface)可以说成是抽象类的一种特例,接口中的所有方法都必须是抽象的.接口中的方法定义默认为public abstract类型,接口中的成员变量类型默认为publi ...
- 【面试题】源石智影科技Python工程师笔试题
哈哈 上图
- 【EF框架】另一个 SqlParameterCollection 中已包含 SqlParameter。
查询报表的时候需要通过两次查询取出数据. 第一次,用count(*)查出总数: 第二次,用rownumber分页取出想要的页内容: 为了防止sql注入,使用SqlParameter来传递参数 var ...
- [转载]Array.prototype.slice.call(arguments,1)原理
Array.prototype.slice.call(arguments,1)该语句涉及两个知识点. arguments是一个关键字,代表当前参数,在javascript中虽然arguments表面上 ...
- 【Java基础】System的arraycopy方法拷贝数组
一.在System类中查看方法的定义 二.示例 public class SystemArrayCopyTest { /** * @Description: System的arrayCopy方法测试 ...