Book::Book()
{
}
Book::Book(const char *name)
{
this->bookname = new char[strlen(name) + 1]; //分配的空间要加一(/0) Buffer is too small
strcpy_s(this->bookname, strlen(name)+1, name); //要把/0也考进去 Buffer is too small
}
Book::~Book()
{
if (bookname != NULL){
delete []bookname;
bookname = NULL;
}
cout << "析构函数被调用" << endl;
}