拷贝构造函数与重载赋值操作符的区别

来源:互联网 发布:淘宝打不开手机相册了 编辑:程序博客网 时间:2024/05/22 03:06

拷贝构造函数通过实参对象的内容来创建新的对象。

重载的赋值操作符将一个已经存在的对象的内容复制到另一个已经存在的对象。

 

What is the difference between a copy constructor and an overloaded assignment operator?

A copy constructor constructs a new object by using the content of the argument object.

An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.

 

 

 

 

原创粉丝点击