-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject.h
More file actions
executable file
·91 lines (67 loc) · 2.25 KB
/
object.h
File metadata and controls
executable file
·91 lines (67 loc) · 2.25 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//object.h
//max smiley
//program # 3
//cs202
//the Object class is a parent to three different classes, outfit, badge, and counter.
//Together these classes describe the different things a user might want to store in
//their avatar. An object is a more simple type with a title - this can be used to model
//the user's name, phone number, or street address. Counters keep track of a count, such
//as the number of wins a user might have. Badges also provide an effect or bonus to the
//avatar - if you've completed enough quests for a certain faction, for example, they
//may reward you with discounted goods at their stores.
#include "string.h"
class Object
{
public:
Object();
Object(String in);
friend std::ostream & operator<<(ostream& out, const Object& object);
friend std::istream & operator>>(istream& in, Object& object);
virtual void display(ostream& out) const;
friend bool operator<(const Object& o1, const Object& o2);
friend bool operator<=(const Object& o1, const Object& o2);
friend bool operator>(const Object& o1, const Object& o2);
friend bool operator>=(const Object& o1, const Object& o2);
friend bool operator!=(const Object& o1, const Object& o2);
friend bool operator==(const Object& o1, const Object& o2);
protected:
String title;
};
class Counter: public Object
{
public:
Counter();
Counter(String in_str, int in_count);
void display(ostream& out) const;
protected:
int count;
};
class Badge: public Object
{
public:
Badge();
Badge(String in_title, String in_bonus);
void display(ostream& out) const;
protected:
String bonus;
};
class Outfit: public Object
{
public:
Outfit();
Outfit(String in_title);
Outfit(const Outfit & to_copy);
~Outfit();
Outfit& operator=(const Outfit& to_copy);
friend Outfit operator+(const Outfit& outfit, const String& string);
friend Outfit operator+(const String& string, const Outfit& outfit);
Outfit& operator+=(const Outfit& to_add);
Outfit& operator+=(const String& to_add);
Outfit& operator+=(const char* c_string);
void display(ostream& out) const;
void add(const String & in);
protected:
int size_curr;
int size_max; //the size of the array;
String * fit; //an array of different outfit items. or perhaps linked list?
};