详细说明调用点各语句是如何实现的。
class CGoods
{
public:
CGoods()
{
_name = new char[1]();
std::cout << this << ":CGoods::CGoods()" << std::endl;
}
CGoods(int amount)
{
_name = new char[1]();
_amount = amount;
std::cout << this << ":CGoods::CGoods(int )" << std::endl;
}
CGoods(char* name, float price, int amount)
{
_name = new char[strlen(name) + 1]();
strcpy_s(_name, strlen(name) + 1, name);
_price = price;
_amount = amount;
std::cout << this << ":CGoods::CGoods(char* , float , int )" << std::endl;
}
~CGoods()
{