摘要:
class Person { public: //this指针的本质 是指针常量 指针的指向是不可以修改的 // const Person * const this; //在成员函数后面加const 修饰的是this指向,让指针的指向的值也不可以修改 void showPerson() const 阅读全文
摘要:
c++中的拷贝构造函数调用时机通常有三种情况 1.使用一个已经创建完毕的对象来初始化一个新的对象 2.值传递的方式给函数参数传值 3.以值方式返回局部对象 //情况1 class Person { public: Person(){ std::cout <<"无参数构造函数" << std::end 阅读全文