QtDesignPatterns/commandpattern/broker.h

23 lines
328 B
C
Raw Normal View History

2024-02-06 17:21:37 +08:00
#include <vector>
#include "interface.h"
class Broker
{
public:
void addOrder(Order *order)
{
vector.push_back(order);
}
void executeAllOrder()
{
for(auto it : vector)
{
it->execute();
}
vector.clear();
}
private:
std::vector<Order *> vector;
};