C++ (Qt) for (std::vector<ICommand *>::iterator it = m_arr.begin() ; it != m_arr.end(); ++it) (*it)->execute();
C++ (Qt) for (ICommand * command : m_arr) command->execute();
C++ (Qt)CommandA * ca = new CommandA;if (ca->IsValid()) ...
C++ (Qt) CommandA *ca = new CommandA; if (checkCommand(ca)) { ca->execute(); }else { delete ca;}
C++ (Qt)template<class Command>bool checkCommand(){...}