Can I declare an object variable without initializing it? This is mostly a scope problem:
If I move the declaration into the try block, it is not in main's scope. I know I can do this:Code:int main () { SomeObj eg; // but this is an initialization ... try { eg(blah blah); // so this is pointless }
But now I am using a pointer when I don't need to; also it's my understanding that if you use new, you then need to explicitly use delete.Code:int main () { SomeObj *eg; try { eg = new SomeObj(blah blah); }
Kind of a hassle, is there any way out?