I want to declare a class if a certain condition is true so i have placed teh constructor in an if statement which in turn is inside a while loop. However i cannot access the class outside the if statement. Is there anyway around this. This is what the code looks like -

void function()

{
While (reason)
{
if (something == true)
{
class newclass;
//Break out of the loop;
break;
}
}//end while
newclass.function1();


Any help would be appreciated/