33,311
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
class Human
{
public:
Human()
{
cout <<"构造函数进行中……\n";
i=999;
}
private:
int i;
};
int main()
{
Human *p=new Human; //顺便帮忙解释一下这代码什么意思?
return 0;
}
#include <iostream>
using namespace std;
class Human
{
public:
Human()
{
cout <<"构造函数进行中……\n";
i=999;
}
private:
int i;
};
int main()
{
Human *p=new Human; //顺便帮忙解释一下这代码什么意思?LS都讲了,开辟一个内存存放一个对象!
//另外c++ 里面的new delete 自动的调用构造函数和析构函数!
return 0;
}