R
Rahul
Hi Everyone,
I have the following code,
class A
{
public : A()
{
}
void show()
{
}
};
int main()
{
cout<<"Enter the number : ";
int n;
cin>>n;
if(n<10)
goto label;
A obj;
label:
obj.show();
return(0);
}
and i get the expected error saying "initialization of obj is skipped
by goto label". But when i remove the definition of the constructor
from the class, i don't the error, why is this so?
Thanks in advance ! ! !
I have the following code,
class A
{
public : A()
{
}
void show()
{
}
};
int main()
{
cout<<"Enter the number : ";
int n;
cin>>n;
if(n<10)
goto label;
A obj;
label:
obj.show();
return(0);
}
and i get the expected error saying "initialization of obj is skipped
by goto label". But when i remove the definition of the constructor
from the class, i don't the error, why is this so?
Thanks in advance ! ! !