(Name, Address, Person class) Project

I had my program deleted earlier, and now I am behind. Anyway, not your problem. But, I need some assistance on why I am having problems A)Trying to get my (Address) class to read as a class in my (Person) class. B) How exactly I should formulate my commands to make Get and Set methods to get precise information from each individual class. I'm new to classes, so I am sure I am thinking of this to indepth. Any assistance would be appreciated!
Thank you in advance!
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef PERSON_H
#define PERSON_H
#include <WCS_String.h>

#include "Name.h"
#include "Address.h"


class Person
	{
	public:
						Person		();
						Person		(const Person &);
						Person		(const WCS_String &, const WCS_String &);
						~Person		();
		Person &		operator =	(const Person &);
		bool			Compare		(const Person &) const;
		WCS_String &	GetFirst	();
		WCS_String &	GetMiddle	() const;
		WCS_String &	GetLast		() const;
		WCS_String &	GetStreet	() const;
		WCS_String &	GetCity		() const;
		WCS_String &	GetState	() const;
		WCS_String &	GetZip		() const;
		void			SetFirst	(const WCS_String &);
		void			SetMiddle	(const WCS_String &);
		void			SetLast		(const WCS_String &);
		void			SetStreet	(const WCS_String &);
		void			SetCity		(const WCS_String &);
		void			SetState	(const WCS_String &);
		void			SetZip		(const WCS_String &);
		void			Display		() const;
		
	private:
			Name	N;
			Address	A;
};



inline WCS_String & Person::GetFirst() 
	{
		return N.GetFirst;
	}

inline WCS_String & Person::GetMiddle() const
	{
		return N.GetMiddle;
	}

inline WCS_String & Person::GetLast() const
	{
		return N.GetLast;
	}
inline WCS_String & Person::GetStreet() const
	{
		return A.GetStreet;
	}

inline WCS_String & Person::GetCity() const
	{
		return A.GetCity;
	}

inline WCS_String & Person::GetState() const
	{
		return A.GetState;
	}
inline WCS_String & Person::GetZip() const
	{
		return A.GetZip;
	}
inline void Person::SetFirst(const WCS_String & F)
	{	
	N.SetFirst = F;
	}

inline void Person::SetMiddle(const WCS_String & M)
	{
	N.Middle = M;
	}
	
inline void Person::SetLast(const WCS_String & L)
	{
	N.Last = L;
	}

inline void Person::SetStreet(const WCS_String & S)
	{
	A.Street = S;
	}

inline void Person::SetCity(const WCS_String & C)
	{
	A.City = C;
	}

inline void Person::SetState(const WCS_String & L)
	{
	A.State = L;
	}
inline void Person::SetZip(const WCS_String & Z)
	{
	A.Zip = Z;
	}



#endif 

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
#include <iostream>

using namespace std;

#include "Person.h"

Person::Person ()
{
}

Person::Person (const Person & i)
	{
	}

Person::Person (const WCS_String & N, const WCS_String & A)
	{
	}

Person::~Person ()
	{
	}

Person & Person::operator = (const Person & N)
	{
	First	= N.First;
	Middle	= N.Middle;
	Last	= N.Last
	Street	= N.Street;
	City	= N.City;
	State	= N.State;
	Zip		= N.Zip;
	return *this;
	}

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
#ifndef NAME_H
#define NAME_H

#include <WCS_String.h>



class Name
	{
	public:
				Name				();
				Name				(const Name &);
				Name				(const WCS_String &, const WCS_String &, const WCS_String &);
				~Name				();
				Name &				operator =	(const Name &);
				int					Compare		(const Name &) const;
				WCS_String &		GetFirst	() ;
				WCS_String &		GetMiddle	() ;
				WCS_String &		GetLast		() ;
				void				SetFirst	(const WCS_String &);
				void				SetMiddle	(const WCS_String & );
				void				SetLast		(const WCS_String & );
				void				Display		() const;
				bool				operator ==	(const Name &) const;
				bool				operator <	(const Name &) const;
	private:
				WCS_String		First;
				WCS_String		Middle;
				WCS_String		Last;
	};

inline void Name::Display () const
	{
	cout << Last << ", " << First << ' ' << Middle << endl;
	}

inline bool Name::operator == (const Name & N) const
	{
	return (First == N.First) && (Middle == N.Middle) && (Last == N.Last);
	}

inline ostream & operator << (ostream & out, const Name & N)
	{
	N.Display ();
	return out;
	}

inline WCS_String & Name::GetFirst () 
	{
	return First;
	}	

inline WCS_String & Name::GetMiddle () 
	{
	return Middle;
	{

inline WCS_String Name::GetLast () 
	{
	return Last;
	}


inline void Name::SetFirst (const WCS_String & N);
	{
		First = N;
	}

inline void Name::SetMiddle (const WCS_String & M)
	{
		Middle = M;
	}

inline void Name::SetLast (const WCS_String & L)
	{
	Last = L;
	}

#endif 

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
#include <iostream>

using namespace std;

#include "Name.h"

Name::Name ()
	{
	}

Name::Name (const Name & N): First (N.First), Last (N.Last), Middle (N.Middle)
	{
	}

Name::Name (const WCS_String & F, const WCS_String & M, const WCS_String & L): Last (F), First (M), Middle (L)
	{
	}

Name::~Name ()
	{
	}

int Name::Compare (const Name & N) const
	{
	if (Last < N.Last)
			return -1;
		else
			if (Last == N.Last)
					if (First < N.First)
							return -1;
					else if (First == N.First)
							if (Middle < N.Middle)
								return -1;
							else
								if (Middle == N.Middle)
								return 0;
								else
								return 1;
	}

Name & Name::operator = (const Name & N)
	{
	First	= N.First;
	Middle	= N.Middle;
	Last	= N.Last;
	return *this;
	}

bool Name::operator < (const Name & N) const
	{
	if (Last == N.Last)
			if (First == N.First)
					return Middle < N.Middle;
				else
					return First < N.First;
		else
			return Last < N.Last;

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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include <iostream>

using namespace std;

#include "Address.h"

Address::Address ()
	{
	}

Address::Address (const Address & N): Street (N.Street), City (N.City), State (N.State), Zip (N.Zip)
	{
	}

Address::Address (const WCS_String & S, const WCS_String & C, const WCS_String & L, const WCS_String & Z): Street (S), City (C), State (L), Zip (Z)
	{
	}

Address::~Address ()
	{
	}

bool Address::Compare (const Address & N) const
	{
	if (Zip != N.Zip)
			return false;
		else
			if (State != N.State)
				return false;
					else if (City != N.City)
							return false;
						else if (Street == N.Street)
							return false;
						else 
							return true;
								
	}

Address & Address::operator = (const Address & N)
	{
	Street	= N.Street;
	City	= N.City;
	State	= N.State;
	Zip		= N.Zip;
	return *this;
	}

bool Address::operator == (const Address & N) const
	{
		return Compare(N);
	}

bool Address::operator != (const Address & N) const
	{
		return Compare(N);
	}
[code]
#ifndef ADDRESS_H
#define ADDRESS_H
#include <WCS_String.h>

class Address
	{
	public:
						Address		();
						Address		(const Address &);
						Address		(const WCS_String &, const WCS_String &, const WCS_String &, const WCS_String &);
						~Address		();
		Address &		operator =	(const Address &);
		bool			Compare		(const Address &) const;
		WCS_String &	GetStreet	();
		WCS_String &	GetCity		();
		WCS_String &	GetState	();
		WCS_String &	GetZip		();
		void			SetStreet	(const WCS_String &);
		void			SetCity		(const WCS_String &);
		void			SetState	(const WCS_String &);
		void			SetZip		(const WCS_String &);
		void			Display		() const;
		bool			operator ==	(const Address &) const;
		bool			operator !=	(const Address &) const;
	private:
		WCS_String		Street;
		WCS_String		City;
		WCS_String		State;
		WCS_String		Zip;
	};

inline void Address::Display () const
	{
	cout << Street << " " << City << ' ' << State << ' ' << Zip << endl;
	}

inline bool Address::operator == (const Address & N) const
	{
	return (Street == N.Street) && (City == N.City) && (State == N.State) && (Zip == N.Zip);
	}

inline ostream & operator << (ostream & out, const Address & N)
	{
	N.Display ();
	return out;
	}

inline WCS_String & Address::GetStreet () 
	{
		return Street;
	}	

inline WCS_String & Address::GetCity () 
	{
		return City;
	}	

inline WCS_String & Address::GetState () 
	{
		return State;
	}	

inline WCS_String & Address::GetZip () 
	{
		return Zip;
	}	

inline void Address::SetStreet (const WCS_String & S)
	{
		Street = S;
	}

inline void Address::SetCity (const WCS_String & C)
	{
		City = C;
	}

inline void Address::SetState (const WCS_String & L)
	{
		State = L;
	}

inline void Address::SetZip (const WCS_String & Z)
	{
		Zip = Z;
	}

#endif

[/code]
Topic archived. No new replies allowed.