c++类中调类的函数
作者:互联网
主函数
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/video/tracking.hpp"
#include "H.h"
#include<set>
using namespace std;
using namespace cv;
class ax{
public:
int bb(int a){
return a+this->v;
}
int v=1;
};
int main() {
int a=1, b=3;
// int c = ax().bb(1,3);
int (ax::*pff)(int);
pff = &ax::bb;
ax oba;
ax* obap = &oba;
obap->v = 3;
int c = Hun().aa(b, obap, pff);
cout << c << endl;
return 0;
}
H.h
#include <iostream>
#include <vector>
class Hun {
public:
template <class T>
int aa(int i, T* obs, int (T::*p)(int)){
int b=3, c=1;
b = (obs->*p)(i);
return b;
}
};
标签:opencv2,obap,int,hpp,c++,调类,ax,include,类中 来源: https://blog.csdn.net/Jay_2018/article/details/111657719