-
Notifications
You must be signed in to change notification settings - Fork 0
/
BusinessNode.cpp
57 lines (45 loc) · 1.21 KB
/
BusinessNode.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
53
54
55
56
57
//
// Created by hloi on 3/30/2022.
//
#include <iostream>
#include "BusinessNode.h"
using namespace std;
const string &BusinessNode::getName() const {
return name;
}
void BusinessNode::setName(const string &name) {
BusinessNode::name = name;
}
const string &BusinessNode::getAddress() const {
return address;
}
void BusinessNode::setAddress(const string &address) {
BusinessNode::address = address;
}
BusinessNode *BusinessNode::getNextNodePtr() const {
return nextNodePtr;
}
void BusinessNode::setNextNodePtr(BusinessNode *nextNodePtr) {
this->nextNodePtr = nextNodePtr;
}
BusinessNode::BusinessNode() {
cout << "default constructor" << endl;
nextNodePtr = nullptr;
}
BusinessNode::BusinessNode(string name, string address, BusinessNode *nextNodePtr) {
cout << "non default constructor" << endl;
this->name = name;
this->address = address;
this->nextNodePtr = nextNodePtr;
}
string BusinessNode::getDescription() const {
return name + " " + address;
}
BusinessNode::~BusinessNode() {
cout << "Business destructor" << endl;
delete nextNodePtr;
}
ostream &operator<<(ostream &out, const BusinessNode &node) {
out << node.getDescription();
return out;
}