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
|