#include<stdlib.h>
class Student
{
private:
int id;
char *name;
public:
Student();
~Student();
};
Student::Student(){
this->id = 1234;
char* name = "leon";
this-> name = name;
};
int main(){
Student leon;
return 0;
}
在C++ 中,初始化一个对象,其实就是在根据这个对象内定义的成员变量的类型预定了一批空间,为什么不需要析构函数中写一些
命令,从而去除这个预定呢?