📄 ch16_05.cpp
字号:
#include <iostream>
using namespace std;
template <class type>
class function
{
private:
type y;
public:
function(type x) {y=x;}
void show()
{
cout<<"y="<<y<<endl;
}
};
int main()
{
function<int> func1(10);
func1.show();
function<float> func2(9.8);
func2.show();
function<char> func3('z');
func3.show();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -