14_3.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:0k
源码类别:

C#编程

开发平台:

Visual C++

  1. //14_3
  2. #include <iostream.h>
  3. class X{
  4. public:
  5.   X(int);
  6.   X(X&);
  7.   ~X();
  8. };
  9. X::X(int s){ cout <<"create a X object with " <<s <<endl; }
  10. X::X(X& x){ cout <<"create a X object from other X objectn"; }
  11. X::~X(){ cout <<"erase a objectn"; }
  12. X f(X x)
  13. {
  14.   cout <<"call a func with para X objectn";
  15.   return x;
  16. }
  17. void main()
  18. {
  19.   X a(1);
  20.   X b=f(X(2));
  21.   a=f(a);
  22. }