class A
{
public:
void print()
{
cout << "hello" << endl;
}
void print2()
{
cout << "hello" << b << endl;
}
int b;
}
int main()
{
A *a;
a->print();// 1
a->print2();// 2
}
答案:
1处不会报错,正常输出 hello
2处会报错,Segmentation fault
网友评论