-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactory.hpp
More file actions
46 lines (39 loc) · 1.31 KB
/
factory.hpp
File metadata and controls
46 lines (39 loc) · 1.31 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
//----------------------------------------------------------------------------
// Factory.h
// Implementation:
// -- Responsible for choosing which Movie class or Trandaction class to
// create. The facotry is just used to create
// Assumptions:
// -- Data files are formatted properly, although data can be incorrect, the
// lower level classes will check the validity of the Transaction methods
// or the Movie type
//----------------------------------------------------------------------------
#ifndef factory_hpp
#define factory_hpp
#include <iostream>
#include <fstream>
#include "classic.hpp"
#include "drama.hpp"
#include "comedy.hpp"
#include "transaction.hpp"
#include "borrow.hpp"
#include "history.hpp"
#include "returnItem.hpp"
const int MAX_ITEMS = 26; // for each letter of alphabet
using namespace std;
class Factory {
public:
// constructors / destructors
Factory();
~Factory();
// returns location in factory for proper object
int subscript(char);
// creates the proper child class objects of Transaction or Movie
Movie* createMovie(char, ifstream&);
Transaction* createTransaction(char, ifstream&);
private:
Movie* storeMovies[MAX_ITEMS];
Transaction* storeTransactions[MAX_ITEMS];
int hash(char) const; // location of proper object
};
#endif