让我们A
成为重载类operator=
如果我按值调用具有参数A
的函数,重载会operator=
被调用吗?
问问题
43 次
1 回答
6
No its assignment operator won't be called.
The copy constructor will be called.
That is the purpose of copy constructor, to create copies of the type by taking in an object of the same type. Pass by value is the typical case where copy constructor is always called.
于 2012-04-15T07:59:35.797 回答