Base and Derived classes

I'm currently at work on this assignment, but I'm coming across compiler errors. It's supposed to display customer information using a base class (PersonData.h) and a derived class (CustomerClass.h).

PersonData.h
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
  #ifndef PERSONDATAH
#define PERSONDATAH
#include "CustomerData.h"
#include <iostream>
#include <string>
using namespace std;

class PersonData
{
protected:
	string lastName; //Person's last name
	string firstName; //Person's first name
	string address; //Person's street address
	string city;	//City of residence
	string state;	//State of residence
	int zip;		//Zip code
	int phone;		//phone number
public:
	PersonData();//Constructor
	PersonData(string, string, string, string, string, int, int); 
	
	//Accessors
	string getLastName();
	string getFirstName();
	string getAddress();
	string getCity();
	string getState();
	int getZip();
	int getPhone();

	//Mutators
	void setLastName(string);
	void setFirstName(string);
	void setAddress(string);
	void setCity(string);
	void setState(string);
	void setZip(int);
	void setPhone(int);
};

#endif 


PersonData.cpp
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
#include "PersonData.h"
#include <iostream>
using namespace std;

PersonData::PersonData() //Constructor
{
lastName = firstName = address = city = state = "";
zip = phone = 0;
}

PersonData::PersonData(string ln, string fn, string addr, string c, string s, int z, int p)
{
	lastName = ln;
	firstName = fn;
	address = addr;
	city = c;
	state = s;
	zip = z;
	phone = p;
}

void PersonData::setLastName(string ln)
{
	lastName = ln;
};

void PersonData::setFirstName(string fn)
{
	firstName = fn;
};

void PersonData::setAddress(string addr)
{
	address = addr;
};

void PersonData::setState(string s)
{
	state = s;
};

void PersonData::setZip(int z)
{
	zip = z;
};

void PersonData::setPhone(int p)
{
	phone = p;
};

string PersonData::getFirstName()
{
	return firstName;
}

string PersonData::getLastName()
{
	return lastName;
}

string PersonData::getAddress()
{
	return address;
}

string PersonData::getCity()
{
	return city;
}

string PersonData::getState()
{
	return state;
}

int PersonData::getPhone()
{
	return phone;
}


CustomerClass.h
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
#ifndef CUSTOMERDATAH
#define CUSTOMERDATAH
#include "PersonData.h"

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

public:
	//Constructor
	CustomerData();
	CustomerData(int, bool);
	
	//Accesssors
	int getCustomerNumber();
	bool getMailingList();

	//Mutators
	void setCustomerNumber(int);
	void setMailingList(bool);
	void print();
};

#endif 


CustomerClass.cpp
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 "CustomerData.h"
#include "PersonData.h"
#include <iostream>
#include <string>
using namespace std;

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

CustomerData::CustomerData(int cn, bool ml)
{
	customerNumber = cn;
	mailingList = ml;
}

void CustomerData::setCustomerNumber(int cn)
{
	customerNumber = cn;
}

void CustomerData::setMailingList(bool ml)
{
	mailingList = ml;
}

int CustomerData::getCustomerNumber()
{
	return customerNumber;
}

bool CustomerData::getMailingList()
{
	return customerNumber;
}

void CustomerData::print()
{
	cout << "Last Name: " << getLastName() << endl;
	cout << "First Name: " << getFirstName() << endl;
	cout << "Address: " << getAddress() << endl;
	cout << "City: " << getCity() << endl;
	cout << "State: " << getState() << endl;
	cout << "ZIP Code: " << getZip() << endl;
	cout << "Customer Number: " << getCustomerNumber() << endl;
	cout << "Mailing List? ";
		if (getMailingList())
		{
			cout << "Yes" << endl << endl;
		}

		else
		{
			cout << "No" << endl << endl;
		}
}


Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <string>
#include "CustomerData.h"
#include "PersonData.h"

int main()
{
	CustomerData c1; //Customer Data objects
	CustomerData c2; 
	
	cout << "Customer #1" << endl;
	cout << "------------" << endl;
	c1.setLastName("Smith");
	c1.setFirstName("Joan");
	c1.setAddress("123 Main Street");
	c1.setCity("Smithville");
	c1.setState("NC");
	c1.setZip(99999);
	c1.setPhone(5555555555);
	c1.setCustomerNumber(12345);
	c1.setMailingList(1);
	c1.print();
}


The errors I'm getting are

1>c:\users\user\documents\visual studio 2012\projects\project10\project10\source.cpp(26): warning C4305: 'argument' : truncation from '__int64' to 'int'
1>c:\users\user\documents\visual studio 2012\projects\project10\project10\source.cpp(26): warning C4309: 'argument' : truncation of constant value
1> PersonData.cpp
1>c:\users\user\documents\visual studio 2012\projects\project10\project10\customerdata.h(6): error C2504: 'PersonData' : base class undefined


What would I need to do to fix these errors? Thanks in advance.
YOu have circular include in your code.

Remove #include "CustomerData.h" from persondata.h
Got rid of it, but I'm still having errors.
Okay, figured out the problem. I was missing a function in the PersonData.cpp.
Topic archived. No new replies allowed.