📄 main.cpp
字号:
#include <iostream>
#include <stdlib.h>
using namespace std;
template <typename T>
class Base {
public:
T a;
};
template <typename T>
class Derived : public Base<T> {
public:
T b;
};
void TestInt(Base<int> *inst) {
cout << inst->a << endl;
}
void TestDouble(Base<double> *inst) {
cout << inst->a << endl;
}
int main(int argc, char *argv[])
{
Base<int> base_int;
Base<double> base_double;
Derived<int> derived_int;
Derived<double> derived_double;
TestInt(&base_int);
TestInt(&derived_int);
TestDouble(&base_double);
TestDouble(&derived_double);
//TestDouble(&derived_int);
system("PAUSE");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -