语法个数:
template<typename T>class Circle
{
static int total;
}
template<typename T> int Circle<T>::total = 0;
产生两个静态类的字段。
clipboard.png
类模板的意义在于帮助你完成一些类,
也就是帮你书写了多个类,而不是写了一个类
目的为了:
算法和数据结构分离
语法个数:
template<typename T>class Circle
{
static int total;
}
template<typename T> int Circle<T>::total = 0;
产生两个静态类的字段。
类模板的意义在于帮助你完成一些类,
也就是帮你书写了多个类,而不是写了一个类
目的为了:
算法和数据结构分离