对象pc-C++动态内存分配

对象pc Name堆字符串拷贝前堆字符串对象pc Name对象pc1 Name深拷贝后图7.1深拷贝堆字符串2深拷贝——自定义拷贝构造CGoods(CGoods & other){ //自定义拷贝构造this->Name=new char[21]; strcpy(this->Name,other.Name); this->Amount=other.Amount; this->Price=other.Price; this->Total_value=other.Total_value;}
ppt 文件大小:158.5KB