执行过程
#include<iostream.h>class Sample
{
int x;
public:
Sample(int a)
{ x=a;
cout<<"constructing object:x="<<x<<endl;
}
};
void func(int n)
{
static Sample obj(n);
}
void main()
{
func(1);
func(10);
}答案:constructing object:x=1
具体是怎样运行的,执行过程麻烦高手讲解一下