为什么我这样写的话,运行结果显示没有运行拷贝函数呢?
#include<iostream>
#include<stdlib.h>
using namespace std;
class Arry
{
public:
Arry()
{
cout<<"Arry()"<<endl;
}
Arry(const Arry&arr)
{
m_iCoor=arr.m_iCoor;
cout<<"Arry(const Arry&arr"<<endl;
}
~Arry()
{
cout<<"~Arry()"<<endl;
}
void setArry(int coor)
{
m_iCoor=coor;
}
int getArry()
{
return m_iCoor;
}
private:
int m_iCoor;
};
int main()
{
Arry arr1,arr2;
arr1.setArry(5);
arr2=arr1;
cout<<arr2.getArry()<<endl;
system("pause");
return 0;
}