It's interesting to see that when A() modifies i to 0, A2 still has i as 2. How come?!Code:class A
{
public:
int i;
A():i(0){
cout<<"A1:"<<endl;
cout<<"i="<<i<<endl;
cout<<"A1 End"<<endl;
}
A(int x):i(x)
{
cout<<"A2:"<<endl;
cout<<"i="<<i<<endl;
A();
cout<<"i="<<i<<endl;
cout<<"A2 End"<<endl;
}
};
int main()
{
A obj(2);
}
int A::i is shared in the obj, right?