class someclass{
private:
int x;
public:
someclass(int x1);
};
someclass::someclass(int x1):x(x1){
}
int main(){
int x;
someclass *a;
if( x < 0) a = new someclass(2);
else a = new someclass(1);
return 0;
}
Basically i want to be able to declare the pointer and then initialise it later to save having to declare multiple pointers.
Being able to do it similar to this would make my code so much cleaner.