还请各位前辈能够指点一下我,谢谢!!
#include<iostream>
using namespace std;
class person
{
public:
person();
~person();
private:
int A;
int B;
int C;
};
person::person()
{
A = 10;
B = 20;
C = 30;
cout << "调用了构造函数!!" << endl;
}
person::~person()
{
cout << "调用了析构函数!!" << endl;
}
void test01()
{
person p;
}
int main()
{
test01();
system("pause");
return 0;
}
我编译通过运行成功了。
程序没问题。
你在开头加上
#include <cstdlib>
试试看
下次提问,最好把编译器报的错误贴上来