枪炮天使,都市炎黄,都市歌丽姿
// // main.cpp // testvoidmain // // created by mac on 2019/4/11. // copyright © 2019年 mac. all rights reserved. // 1.只有成员函数才能有const限定符 // 2.脑袋怎么总是混乱 // 3.在类内部定义指向函数的指针有点蠢? #include <iostream> using namespace std; template <class gentype> class classf{ public: classf(){ } ~classf(){} gentype fun1(gentype &); gentype (classf:: *p)(gentype &)=&classf::fun1; }; template<class gentype> gentype classf<gentype>::fun1(gentype &a){ return a; } int main(int argc, const char * argv[]) { classf<int> cf,*q=&cf; int a=3; cout<<cf.fun1(a)<<endl; cout<<(cf.*p(a)); cout << "hello, world!\n"; return 0; }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
如何在没有core文件的情况下用dmesg+addr2line定位段错误
用QT制作3D点云显示器——QtDataVisualization
网友评论