For standard data objects, such as int, you can do the following:
int number; number = 0;
Basically, you can declare a number before initializing it, useful if you initialize inside various if statements, and you don't want the number to go outside the scope.
Is it possible to do something similar with custom classes?
I have a class called mem_array with a form constructor
mem_array(int,int,std::string);
I would like to do the following
mem_array myData; if(x==0) myData(1,1,"up"); if(x==1) myData(0,0,"down");
basically, so I can use myData outside the scope of if statements. Could this be done?
source share