//file : CAddress01.cpp
//date : 04/03/2002
//author: AOU
#include <iostream.h>
#include <time.h>
#include <stdlib.h>
class CAddress
{
private:
char *firstName;
char *lastName;
char *street;
char *city;
char *state;
char *zip;
public:
CAddress(void);
friend ostream & operator << (ostream &bob, const CAddress &a);
};
void main(void)
{
CAddress a1;
cout << a1 << endl;
}
ostream & operator << (ostream &bob, const CAddress &a)
{
bob << "\nFirst Name: ";
if (a.firstName != NULL) bob << a.firstName;
bob << "\n Last Name: ";
if (a.lastName != NULL) bob << a.lastName;
bob << "\n Street: ";
if (a.street != NULL) bob << a.street;
bob << "\n City: ";
if (a.city != NULL) bob << a.city;
bob << "\n State: ";
if (a.state != NULL) bob << a.state;
bob << "\n Zip: ";
if (a.zip != NULL) bob << a.zip;
return bob;
}
CAddress::CAddress(void)
{
firstName = NULL;
lastName = NULL;
street = NULL;
city = NULL;
state = NULL;
zip = NULL;
}
|