if (choice ==1){
Light *myobj = new Light();
}
FlipUpCommand switchUp(*myobj);

Error: `myobj' undeclared (first use this function)

Please advice how to solve this problem without changing the Light class.