this my cpp file :

//******************************************************
// Chapter 15, Programming Challenge 7                 *
// PersonData and CustomerData classes                 *
//******************************************************
#include <iostream>
#include "PersonData.h"
#include "CustomerData.h"
using namespace std;

// Function prototypes
void displayPerson(PersonData);
void displayCustomer(CustomerData);

int main()
{
   // Create a PersonData object and pass arguments
   // to the constructor. All of the arguments are
   // C++ strings 
   PersonData person1("Student", "Joe", "123 Bulldog Street",
                          "Starkville", "MS", "39759", "662-555-1234");
   
   // Display the object's data.
   cout << "Person #1\n"
        << "-----------\n";
   displayPerson(person1);

   // Create a CustomerData object and pass arguments
   // to the constructor. All of the arguments are
   // C++ strings except customerNumber and mailingList
   CustomerData customer1("Smith", "Joan", "123 Main Street",
                          "Smithville", "NC", "99999", "123-123-1234", 12345,
                          true);
   
   // Display the object's data.
   cout << "Customer #1\n"
        << "-----------\n";
   displayCustomer(customer1);
   
   // Create another CustomerData object using the default
   // constructor and mutator functions. All of the arguments 
   // are C++ strings except customerNumber and mailingList
   CustomerData customer2;
   customer2.setLastName("Jones");
   customer2.setFirstName("Jenny");
   customer2.setAddress("555 East Street");
   customer2.setCity("Jonesville");
   customer2.setState("VA");
   customer2.setZip("88888");
   customer2.setPhone("888-888-8888");
   customer2.setCustomerNumber(77777);
   customer2.setMailingList(false);
   
   // Display the object's data.
   cout << "Customer #2\n"
        << "-----------\n";
   displayCustomer(customer2);
   return 0;
}

//******************************************************
// The displayPerson function accepts a PersonData     *
// object as its argument and displays the object's    *
// data.                                               *
//******************************************************

void displayPerson(PersonData p)
{
   // Display all the data...
   cout << "Last Name: " << p.getLastName() << endl
        << "First Name: " << p.getFirstName() << endl
        << "Address: " << p.getAddress() << endl
        << "City: " << p.getCity() << endl
        << "State: " << p.getState() << endl
        << "ZIP: " << p.getZip() << endl 
        << "Phone: " << p.getPhone() << endl << endl;
}


//******************************************************
// The displayCustomer function accepts a CustomerData *
// object as its argument and displays the object's    *
// data.                                               *
//******************************************************

void displayCustomer(CustomerData c)
{
   // Display all the data but mailing list...
   cout << "Last Name: " << c.getLastName() << endl
        << "First Name: " << c.getFirstName() << endl
        << "Address: " << c.getAddress() << endl
        << "City: " << c.getCity() << endl
        << "State: " << c.getState() << endl
        << "ZIP: " << c.getZip() << endl 
        << "Phone: " << c.getPhone() << endl
        << "Customer Number: " 
        << c.getCustomerNumber() << endl
        << "Mailing List? ";

   // Display Yes or No for mailing list.
   if (c.getMailingList())
        cout << "Yes" << endl << endl;
   else
         cout << "No" << endl << endl;
}

my base class:

#ifndef PERSONDATA_H
#define PERSONDATA_H

using namespace std;

class PersonData
{
protected:
	string lastName;
	string firstName;
	string address;
	string city;
	string state;
	string zip;
	string phoneNumber;

public:

	PersonData()
	{
		firstName="unknown";
		lastName="unknown";
		address="unknown";
		city="unknown";
		state="unknown";
		zip="unknown";
		phoneNumber="unknown";

	}

	PersonData(string last,string first,string add,string city,string state,string zip,string num)
	{
		setLastName(last);
		setFirstName(first);
		setAddress(add);
		setCity(city);
		setState(state);
		setZip(zip);
		setPhone(num);

	}

	void setLastName(string last)
	{
		lastName=last;
	}

	void setFirstName(string first)
	{
		firstName=first;
	}

	void setAddress(string add)
	{
		address=add;
	}

	void setCity(string city)
	{
		city=city;
	}
	void setState(string state)
	{
		state=state;
	}

	void setZip(string zip)
	{
		zip=zip;
	}

	void setPhone(string num)
	{
		phoneNumber=num;
	}
	
	string getLastName()
	{
		return lastName;
	}

	string getFirstName()
	{
		return firstName;
	}

	string getAddress()
	{
		return address;
	}

	string getState()
	{
		return state;
	}

	string getZip()
	{
		return zip;
	}

	string getCity()
	{
		return city;
	}

	string getPhone()
	{
		return phoneNumber;
	}


};
#endif

my Deriverd Class:

#ifndef CUSTOMERDATA_H
#define CUSTOMERDATA_H
#include"PersonData.h"

using namespace std;

class CustomerData: public PersonData
{
private:
	int customerNumber;
	bool mailingList;

public:

CustomerData()
{
	customerNumber=0;
	mailingList=false;
}

CustomerData(string last,string first,string add,string city,string state,string zip,string num,int cust,bool list):PersonData(last,
first,add,city,state,zip,num)
{
	setCustomerNumber(cust);
	setMailingList(list);
}

void setCustomerNumber(int num)
{
	customerNumber=num;
}

void setMailingList(bool list)
{
	if(list==false)
	{
	}
	else
		mailingList=true;
}

int getCustomerNumber()
{
	return customerNumber;
}

bool getMailingList()
{
	return mailingList;
}


};

#endif

when compile it i get this error:

Compiling...
1>driver.cpp


1>c:\users\ankit arya\documents\visual studio 2008\projects\hw3\hw3\driver.cpp(69) : error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)


1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\ostream(653): could be 'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)'

i think the first error it has some problem with my function but i am not able to figure out what?

for the second error i have no clue can someone help??

You forgot to include the string header.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.