static void Main(string[] args) { var sm = new Lamp(); sm.PressSwitch(); //go on sm.PressSwitch(); //go off sm.PressSwitch(); //go on sm.GotError(); //get error sm.PressSwitch(); //go off }