-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyify.cc
More file actions
69 lines (51 loc) · 1.18 KB
/
Keyify.cc
File metadata and controls
69 lines (51 loc) · 1.18 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
69
#ifndef _KEYIFY_CC_
#define _KEYIFY_CC_
#include <iostream>
#include "Keyify.h"
#include "Swap.h"
using namespace std;
template <class Type>
Keyify <Type> :: Keyify () {
}
template <class Type>
Keyify <Type> :: Keyify (const Type castFromMe) {
data = castFromMe;
}
template <class Type>
Keyify <Type> :: ~Keyify () {
}
template <class Type>
Keyify <Type> :: operator Type () {
return data;
}
template <class Type> Type
Keyify <Type> :: getData () {
return data;
}
template <class Type> void
Keyify <Type> :: Swap (Keyify &withMe) {
SWAP(data, withMe.data);
}
template <class Type> void
Keyify <Type> :: CopyFrom (Keyify &withMe) {
data = withMe.data;
}
template <class Type> int
Keyify <Type> :: IsEqual(Keyify &checkMe) {
return (data == checkMe.data);
}
template <class Type> int
Keyify <Type> :: LessThan (Keyify &checkMe) {
return (data < checkMe.data);
}
// redefine operator << for printing
template <class Type> ostream&
operator<<(ostream& output, const Keyify<Type>& _s) {
Keyify<Type> newObject;
newObject.Swap(const_cast<Keyify<Type>&>(_s));
Type st = newObject;
output << st;
newObject.Swap(const_cast<Keyify<Type>&>(_s));
return output;
}
#endif //_KEYIFY_CC_