一道简单的C++面试题,求解题过程
求下面代码的输出结果:
#include "stdafx.h"#include <iostream>using namespace std;class abc{public: abc() { cout<<"abc"<<endl; } ~abc() { cout<<"~abc"<<endl; }};void Test(abc pobj){ }int _tmain(int argc, _TCHAR* argv[]){ abc pobj; Test(pobj); return 0;}Test(pobj);//这个调用的是拷贝构造函数,没有调用默认的构造函数,所以没有打印第二个abc