-
Notifications
You must be signed in to change notification settings - Fork 0
/
BusinessList.cpp
52 lines (43 loc) · 978 Bytes
/
BusinessList.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// Created by hloi on 3/30/2022.
//
#include <iostream>
#include "BusinessList.h"
using namespace std;
BusinessNode *BusinessList::getHead() const {
return head;
}
void BusinessList::setHead(BusinessNode *head) {
BusinessList::head = head;
}
BusinessNode *BusinessList::getTail() const {
return tail;
}
void BusinessList::setTail(BusinessNode *tail) {
BusinessList::tail = tail;
}
BusinessList::BusinessList() {
head = nullptr;
tail = nullptr;
}
void BusinessList::push_back(BusinessNode *node) {
if (head == nullptr) {
head = node;
tail = node;
}
else {
tail->setNextNodePtr(node);
tail = node;
}
}
ostream &operator<<(ostream &out, const BusinessList &list1) {
BusinessNode* currObj = list1.getHead();
while (currObj != nullptr) {
out << *currObj << endl;
currObj = currObj->getNextNodePtr();
}
return out;
}
BusinessList::~BusinessList() {
delete head;
}