📄 main.cpp
字号:
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
class Gobstopper {
public:
static string MyClassName() {
return "Gobstopper!";
}
int WhichGobstopper;
int Chew(string name) {
cout << WhichGobstopper << endl;
cout << name << endl;
return WhichGobstopper;
}
};
int main(int argc, char *argv[])
{
typedef int (Gobstopper::*GobMember)(string);
GobMember func = &Gobstopper::Chew;
Gobstopper inst;
inst.WhichGobstopper = 10;
Gobstopper another;
another.WhichGobstopper = 20;
(inst.*func)("Greg W.");
(another.*func)("Jennifer W.");
typedef string (*StaticMember)();
StaticMember staticfunc = &Gobstopper::MyClassName;
cout << staticfunc() << endl;
system("PAUSE");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -