📄 main.cpp
字号:
typedef struct Point_STRUCT
{
int x;
int y;
}Point;
class Shape
{
public:
void moveTo(Point newLocation){};
bool validate() const;
virtual bool draw() const=0;
};
class Circle:public Shape
{
bool draw() const;
};
void (Shape::*mf1)(Point)=&Shape::moveTo;
class B
{
public:
void bset(int val){bval_=val;}
private:
int bval_;//有的地方私有变量下划线加在前面
};
class D:public B
{
public:
void dset(int val){dval_=val;}
private:
int dval_;
};
B b;
D d;
//void (B::*f1)(int)=&D::dsetp; //错误
//(b.*f1)(12); //错误
void (D::*f2)(int)=&B::bset; //正确
void main()
{
(d.*f2)(11); //正确
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -