析构函数在包括他的右括号处被调用
6.3.2 内存分配
//:C06:Nojump.cpp
//Can't jump past constructors
class X
{
public:
X();
};
X::X() {};
void f(int i)
{
if(i < 10)
{
goto jump1;
//Error: got bypasses init
}
X x1;//Constructor called here
jump1:
switch(i)
{
case 1:
X x2; //Constructor called here
break;
case 2:
X x3;//Constructor called here
break;
}
}
int main()
{
f(9);
f(11);
}///:~
类构造的部分不能被跳过