C++构造函数与复制构造函数调用情况
#include "IPermanceServiceShare.h"
#include <string>
#include <deque>
#include <iostream>
using namespace std;
class CAnimal
{
public:
CAnimal(){ cout << " Animal constrcutio invoke " << endl; }
CAnimal(const CAnimal &animal){cout << "Animal copy construction invoke" << endl; }
~CAnimal(){};
};
void main()
{
CAnimal example;
CAnimal example2(example);
/*************************************
*输出:
*Animal constrcutio invoke
*Animal copy construction invoke
*
*************************************/
int wait;
cin >> wait;
}

浙公网安备 33010602011771号