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/Pizza.hpp

76 lines
1.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Pizza.hpp
*
* Created on: 2 нояб. 2021 г.
* Author: alexander
*/
#pragma once
#include <iostream>
#include <list>
class Pizza
{
private:
std::string name;
std::string dough;
std::string sauce;
std::list<std::string> toppings;
public:
virtual void prepare() const
{
std::cout << "Preparing " << name << std::endl;
std::cout << "Tossing dough..." << std::endl;
std::cout << "Adding sauce..." << std::endl;
std::cout << "Adding toppings:" << std::endl;
for (const std::string &topping : toppings)
{
std::cout << '\t' << topping << std::endl;
}
}
virtual void bake() const
{
std::cout << "Bake for 25 minutes at 350" << std::endl;
}
virtual void cut() const
{
std::cout << "Cutting the pizza into diagonal slices" << std::endl;
}
virtual void box() const
{
std::cout << "Place pizza in official PizzaStore box" << std::endl;
}
virtual std::string getName() const
{
return name;
}
virtual void setName(std::string name)
{
this->name = name;
}
virtual void setDough(std::string dough)
{
this->dough = dough;
}
virtual void setSauce(std::string sauce)
{
this->sauce = sauce;
}
virtual void addTopping(std::string topping)
{
toppings.push_back(topping);
}
virtual ~Pizza() {}
};