标签:info bubuko 属性 结果 div com 输出 inf 结构体
刚做了个程序,需要通过调用结构体属性执行函数,百度了一下,豁然开朗。下面是相关代码:
指向无返回值函数:
#include <iostream> typedef void(*voidPointer)(); struct testPointerStruct{ voidPointer TestPointer; }; void hahah(); int main(){ testPointerStruct testPointerObject; testPointerObject.TestPointer=hahah; testPointerObject.TestPointer(); } void hahah(){ std::cout << "测试" << std::endl; }
输出结果:
标签:info bubuko 属性 结果 div com 输出 inf 结构体
原文地址:https://www.cnblogs.com/oinx/p/funcPointer1.html