📄 a.h
字号:
//类A、B和C的定义及实现
#include <iostream>
using namespace std;
class A
{
protected:
int type; // 说明该类的类型,如果是A,那么type = 0
public:
A() { type = 0; }
void Display()
{
cout << "A::Display()\n";
}
int GetType() { return type; } //返回类型
void Hello() { Display(); }
};
class B : public A
{
public:
B() { type = 1; } //类为B,所以type = 1
void Display()
{
cout <<"B::Display()\n";
}
};
class C : public A
{
public:
C() { type = 2; } //类为C,所以type = 2
void Display()
{
cout <<"C::Display()\n";
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -