-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSupplier.h
More file actions
63 lines (50 loc) · 1.23 KB
/
Supplier.h
File metadata and controls
63 lines (50 loc) · 1.23 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef Supplier_H
#define Supplier_H
#include <string>
#include <ostream>
class Supplier {
private:
int supplier_id;
std::string s_name;
std::string description;
std::string email;
std::string address;
public:
Supplier() : supplier_id(0), s_name(""), description(""), email(""), address("") {}
Supplier(
int supplier_id,
std::string s_name,
std::string description,
std::string email,
std::string address
) : supplier_id(supplier_id),
s_name(s_name),
description(description),
email(email),
address(address) {}
const int getSupplierID() {
return supplier_id;
}
const std::string& getDescription() {
return description;
}
const std::string& getEmail() {
return email;
}
const std::string& getAddress() {
return address;
}
/*
- Custom print method for printing out a supplier
NOTE: We omit the description since it can be lengthy.
*/
friend std::ostream& operator<<(std::ostream& os, const Supplier& supplier) {
os << "<Supplier ID(" << supplier.supplier_id << "), name(" << supplier.s_name << "), email(" << supplier.email << "), address(" << supplier.address << ")/>";
return os;
}
// !supplier is true, when supplier_id = 0
bool operator!() const {
return supplier_id == 0;
}
};
#endif