下面的结果输出为
class A
{
public:
int a;
int b;
public:
A(){cout <<a<<endl; a = 100; b = 200;}
~A(){};
void fun(){cout<<a<<endl;}
};
class C
{
public:
int a;
public:
C(){cout <<a<<endl; a=300;}
~C(){}
void fun(){cout<<a<<endl;}
};
int main(){
A a;
C c;
a.fun();
c.fun();
}
out:
0 //初始化为0
4248818 //未初始化为0
100
300