copy和copy assignment的区别

copy和copy assignment的区别
#include  < cstdlib >
#include 
< iostream >
using   namespace  std;

class  foo
{
public:
    foo()
{}
    foo(
const foo& other){cout<<"copy\n";}
    foo
& operator=(foo& rhs){cout<<"assign\n"return *this;}
}
;

int  main()
{
    foo f;
    foo f2 
= f;
    foo f3;
    f3 
= f;
    system(
"PAUSE");
    
return 0;
}

你可能感兴趣的:(copy和copy assignment的区别)