C++ declare class variable outside of "if-else"

c++, overloading

Solution

auto mc = (boolVar? MyClass( 10 ) : MyClass( 10, 20 ));

Problem

Is it possible to declare class variable outside of "if-else" and initialize it inside the "if-else"? something like this: ``` myClass mc; if (bOOlVar){ mc(10); } else{ mc(10,20); } ``` assuming I have 2 cons' for myClass(one that receives int and one that receives 2 ints) thanks a lot

Original source