我有以下课程:
class Point2D
{
protected:
double x;
double y;
public:
double getX() const {return this->x;}
double getY() const {return this->y;}
...
};
和指向另一个类中声明的成员函数的指针:
double ( Point2D :: *getCoord) () const;
如何声明/初始化指向成员函数的指针:
1]静态类成员函数
Process.h
class Process
{
private:
static double ( Point2D :: *getCoord) () const; //How to initialize in Process.cpp?
...
};
2]非类成员函数
Process.h
double ( Point2D :: *getCoord) () const; //Linker error, how do declare?
class Process
{
private:
...
};