#include<iostream>
using namespace std
;
template <class typemun>
class point{
public:
point(typemun xx
){
x
=xx
;
cout
<<"调用了构造函数"<<endl
;
}
point(const point
&a
){
cout
<<"调用了拷贝函数"<<endl
;
x
=a
.x
;
}
~point(){
cout
<<"析构函数"<<endl
;
}
private:
typemun x
;
};
void fun(point
<int> a
){
cout
<<"调用了函数"<<endl
;
}
int main() {
point
<int> a(3);
point
<int> b(a
);
fun(b
);
return 0;
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-41251.html