模板类c和静态成员变量如果一个模板类生成不同的类,则每个类生成的对象将共享静态变量,而静态成员变量在类级别起作用
# includeiostreamusingnamespacestd; templateclasstclasstem { public : tem () {}~Tem ) {}static int stat; (; templateclasstinttemt : stat=0; int main () (cout(--------'endl; Temint int_1,int_2; int_1.stat; cout ' int :3360336033603360 ' int _2. stat endl; Temdouble double_1,double_2; double_1.stat =8; cout ' double :3360: ' double _1. stat endl; 返回0; }输出结果不同