-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitem.h
More file actions
64 lines (52 loc) · 2.07 KB
/
Copy pathitem.h
File metadata and controls
64 lines (52 loc) · 2.07 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
/* Aaron Parks
* Prof. Carol Zander
* CSS 343 : Winter 2010
* Lab 4v3 - MOVIE Store */
/*-- Item ----------------------------------------------------------------------
* Base (parent) for all rentable things in the store. Item is the lowest level,
* thus most basic form, of an Item. As such, it mostly contains pure virutal
* functions to be overridden with object-specific instructions. The one
* non-pure virtual function is for managing the stock of an Item which is a
* universal activity for physical, rentable, products.
*
*-- Assumptions ---------------------------------------------------------------
* - stockAdjustment
* -> 'stock' and 'borrowed' will never have to be modified more than +1 or -1
*----------------------------------------------------------------------------*/
#ifndef ITEM_H
#define ITEM_H
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int const INITIAL_STOCK = 10; //starting count of items in stock
class Item
{
public:
//constructor
Item();
//pure virtual functions //to be overridden by children
//calls constructor
virtual Item* createItem(ifstream&) = 0;
//boolean comparison operators
virtual bool operator==(const Item&) const = 0;
virtual bool operator!=(const Item&) const = 0;
virtual bool operator>(const Item&) const = 0;
virtual bool operator<(const Item&) const = 0;
virtual bool operator>=(const Item&) const = 0;
virtual bool operator<=(const Item&) const = 0;
//for displaying item header
virtual void header() const = 0;
//for displaying formatted output
virtual void display() const = 0;
//for displaying formatted output for transactions
virtual void display_t() const = 0;
//for increasing stock during duplicate insertion
virtual void increaseStock() = 0;
//modifies 'stock' and 'borrowed' values
virtual bool stockAdjustment(int,int);
protected:
int stock; //number of this item in stock
int borrowed; //number of this item currently borrowed
};
#endif