#include "stdafx.h"
#include <iostream>
using namespace std;
class A
{
private:
int value;
public:
A(int n){ value=n; }
A( A other) { value=other.value;}
void Print(){ std::cout<<value<<std::endl; }
};
int _tmain(int argc, _TCHAR* argv[])
{
A a=10; //初始化
A b=a; //拷贝构造函数
b.Print();
return 0;
}
C++ 拷贝构造函数深度剖析
最新推荐文章于 2024-08-02 21:59:11 发布