This repository has been archived on 2022-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
patterns-old/lesson_4/PizzaStore.hpp

33 lines
570 B
C++
Raw Permalink Normal View History

2021-11-02 18:18:09 +00:00
/*
* PizzaStore.hpp
*
2021-11-03 15:35:58 +00:00
* Created on: 3 нояб. 2021 г.
2021-11-02 18:18:09 +00:00
* Author: alexander
*/
#pragma once
#include "Pizza.hpp"
class PizzaStore
{
public:
2021-11-03 15:35:58 +00:00
virtual Pizza* orderPizza(const std::string &type) const
2021-11-02 18:18:09 +00:00
{
2021-11-03 15:35:58 +00:00
Pizza *pizza = createPizza(type);
2021-11-02 18:18:09 +00:00
2021-11-03 15:35:58 +00:00
std::cout << "--- Making a " << pizza->getName() << " ---" << std::endl;
pizza->prepare();
pizza->bake();
pizza->cut();
pizza->box();
2021-11-02 18:18:09 +00:00
return pizza;
}
2021-11-03 15:35:58 +00:00
virtual Pizza* createPizza(const std::string &type) const = 0;
2021-11-02 18:18:09 +00:00
virtual ~PizzaStore() {}
};