-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodoVenta.cpp
More file actions
68 lines (52 loc) · 1.14 KB
/
NodoVenta.cpp
File metadata and controls
68 lines (52 loc) · 1.14 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
64
65
66
67
68
#include "NodoVenta.h"
using namespace std;
NodoVenta::NodoVenta() : next(nullptr), prev(nullptr)
{}
NodoVenta::NodoVenta(Venta &v) : next(nullptr), prev(nullptr)
{
if((dataPtr = new Venta(v)) == nullptr)
{
cout << "Excepcion, memoria insuficiente, NodoVenta constructor" <<endl;
}
}
NodoVenta::~NodoVenta() {
delete dataPtr;
}
void NodoVenta::setDataPtr(Venta *ptr) {
dataPtr = ptr;
}
void NodoVenta::setData(Venta &data) {
if(dataPtr == nullptr)
{
if((dataPtr = new Venta(data)) == nullptr)
{
cout << "excepcion, memoria insuficiente, setData NodoVenta set data" << endl;
}
}
else
{
*dataPtr = data;
}
}
void NodoVenta::setNext(NodoVenta *n) {
next = n;
}
void NodoVenta::setPrev(NodoVenta *p) {
prev = p;
}
Venta *NodoVenta::getDataPtr() {
return dataPtr;
}
Venta &NodoVenta::getData() {
if(dataPtr == nullptr)
{
cout << "excepcion, get data, nodo Venta, memoria insuficiente" << endl;
}
return *dataPtr;
}
NodoVenta *NodoVenta::getNext() {
return next;
}
NodoVenta *NodoVenta::getPrev() {
return prev;
}