Реализации на С++
Command
Общая реализация на языке С++
template <typename Reseiver>
class Command
{
public:
virtual ~Command() = default;
virtual void execute(shared_ptr<Reseiver>) = 0;
};
# include <iostream>
# include <memory>
using namespace std;
int main()
{
shared_ptr<Command<Object>> command = make_shared<SimpleCommand<Object>>(&Object::run);
shared_ptr<Object> obj = make_shared<ConObject>();
command->execute(obj);
}
Last updated
Was this helpful?