-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscoop.cpp
30 lines (23 loc) · 831 Bytes
/
scoop.cpp
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
#include "scoop.h"
namespace Mice {
Scoop::Scoop(std::string name, std::string description, double cost, double price)
: Item(name, description, cost, price) { }
Scoop::Scoop(std::istream& ist) {
// The header must have been stripped from the incoming stream at this point
getline(ist, _name);
ist >> _cost; ist.ignore();
ist >> _price; ist.ignore();
ist >> _quantity; ist.ignore();
getline(ist, _description);
}
void Scoop::save(std::ostream& ost) {
ost << "#" << std::endl << "SCOOP" << std::endl; // header
ost << _name << std::endl;
ost << _cost << std::endl;
ost << _price << std::endl;
ost << _quantity << std::endl;
ost << _description << std::endl;
}
std::string Scoop::type() const {return "Scoop";}
void Scoop::set_photo(std::string photo) {_photo = photo;}
}