#include <iostream>
using namespace std;
class A
{
public:
void print() { cout << "hello" << endl; }
int a;
};
int main()
{
A a;
A *pa = &a;
delete pa;
return 0;
}
会产生运行时错误。
#include <iostream>
using namespace std;
class A
{
public:
void print() { cout << "hello" << endl; }
int a;
};
int main()
{
A a;
A *pa = &a;
delete pa;
return 0;
}
会产生运行时错误。