一、原码分析
1.1 测试代码
为了方便查看拷贝构造函数调用过程,自定义了拷贝构造函数,但啥也没干。
class CTEST
{
public:
int m_nData;
//Method:
public:
CTEST()
{
printf("0x%p CTEST is constructed\n", this);
}
CTEST(CTEST& oCtest)
{
printf("0x%p CTEST copy constructor is called, copy object from 0x%p\n", this, &oCtest);
}
~CTEST()
{
printf("0x%p CTEST is destructed\n", this);
}
};
CTEST GetCTest()
{
CTEST oCtest;
return oCtest;
}
int main(int argc, char* argv[])
{
printf("***************************Test1***************************\n\n");
CTEST oTest1 = GetCTest();
prin
订阅专栏 解锁全文
2837

被折叠的 条评论
为什么被折叠?



