-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransaction.cpp
More file actions
52 lines (42 loc) · 1.71 KB
/
Transaction.cpp
File metadata and controls
52 lines (42 loc) · 1.71 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
// Blake Berry
// 03/08/2022
// Homework 4
// This file is an implimentatione for the Transaction class. The Transaction
// class wraps a item transacted upon and stores a representation of the
// transaction type. This class then produces a pointer to itself for refrence
// by other classes needing transaction information.
//-----------------------------------------------------------------------------
#include "Transaction.h"
#include "Coin.h"
//------------------------ Constructor -------------------------------------
// Constructs a transaction from a given item and the type of transaction
// taken
// Postconditions: couples a item with the transaction that was taken on
// the item
Transaction::Transaction(const Collectible*& item, std::string type) :
itemTransacted_(item),
transactionType_(type)
{
}
//------------------------ getTransactionType ------------------------------
// returns the type of transaction done on the item
// Postconditions: returns a string representation of the transaction type
// on the item
std::string Transaction::getTransactionType() const
{
return transactionType_;
}
//------------------------ getItemTransacted -------------------------------
// returns the item transacted
// Postconditions: a constant pointer to that item is returned
const Collectible* Transaction::getItemTransacted() const
{
return itemTransacted_;
}
//------------------------- Destructor -------------------------------------
// Frees the transaction of any dynamic memory, the transaction does not
// own the item data -- it is to be freed by the itemManager.
// Postconditions: frees any dynamic memory associated with the transaction
Transaction::~Transaction()
{
}