-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPizza.hpp
More file actions
37 lines (33 loc) · 998 Bytes
/
Pizza.hpp
File metadata and controls
37 lines (33 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef PIZZA_H
#define PIZZA_H
#include <iostream>
#include <string>
#include <vector>
class Pizza {
public:
Pizza () = default;
virtual ~Pizza () = default; // necessay if class includes a virtual function
virtual void prepare() const;
virtual void bake() const { std::cout << "Bake for 25 minutes at 350\n"; }
virtual void cut() const { std::cout << "Cutting the pizza into diagonal slices\n"; }
virtual void box() const { std::cout << "Place pizza in offical PizzaStore box\n"; }
std::string getName() const { return name; }
protected:
// using in-class initialization
std::string name = {};
std::string dough = {};
std::string sauce = {};
std::vector<std::string> toppings = {};
};
inline
void
Pizza::prepare() const
{
std::cout << "Preparing " + name;
std::cout << "Tossing dough...\n";
std::cout << "Adding sauce...\n";
std::cout << "Adding toppings: \n";
for (const auto &topping : toppings)
std::cout << " " + topping << '\n';
}
#endif /* PIZZA_H */