-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinkedHashStock.cpp
49 lines (37 loc) · 923 Bytes
/
LinkedHashStock.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
#include "LinkedHashStock.h"
/*
* ETK - April 2022
* LinkedHashStock class
* provides a node suitable for the linked list
* in a hash table with chaining
* Nodes contain a pointer to an Stock and pointer
* to the next entry in the list.
*/
// constructors
LinkedHashStock::LinkedHashStock(Stock *s): stock(s), next(nullptr){};
LinkedHashStock::LinkedHashStock(string n, string t, int q, double p):
stock(new Stock(n,t, q, p)), next(nullptr){};
// destructor
LinkedHashStock::~LinkedHashStock(){
delete stock;
};
// mutators
void LinkedHashStock::setStock(Stock *s){
this->stock = s;
};
void LinkedHashStock::setNext(LinkedHashStock *n){
this->next = n;
};
// accessors
string LinkedHashStock::getKey(){
if (stock != nullptr)
return stock->getKey();
else
return nullptr;
};
Stock * LinkedHashStock::getStock(){
return stock;
};
LinkedHashStock * LinkedHashStock::getNext(){
return next;
};