//
// 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;
}
保留一个未解决的问题
猜你喜欢
转载自www.cnblogs.com/overlows/p/10690570.html
今日推荐
周排行