📄 ch16_06.cpp
字号:
#include <iostream>
using namespace std;
template <class type>
class cube
{
private:
type length;
type width;
type height;
type volume;
public:
void set_length(type len)
{
length = len;
}
void set_width(type wid)
{
width = wid;
}
void set_height(type hei)
{
height = hei;
}
void calculate();
void show_volume();
};
//---------------------------------
template <class type>
void cube<type>::calculate()
{
volume = length*width*height;
}
//---------------------------------
template <class type>
void cube<type>::show_volume()
{
cout<<"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -