I am working with classes for the first time. I am trying to make an address book. While I think I have done my header files and class definition files correctly, I am running into a snag with getting it to show on the screen. I went back to a practice assignment I did that was somewhat similar. The only difference is, besides the obvious that is not an address book, is I didn't have to make it print on screen. I tried the following code:

void showStudents(ifstream& infile, studentType studentList[], int numberOfStudents)
{
	int count;

	for (count = 0; count < numberOfStudents; count++)
		cout << studentList[count].getFirstName << " " << studentList[count].getLastName << endl;
}

studentType is defined as

class studentType: public personType

This is the first question I have, does that mean studentType is the base class or persoType is the base class?

Anyways, as you can tell, I turned studentType into an array studentList[]. I am trying to get the first and last name of the students to print on a screen for a menu to choose from. the first name and last name is stored in class personType. When I try to compile the oroginal code I posted, void showStudents{.....},
I get an error code CS3867, and something about using pointers. If anyone can understand what I am trying to get at, please help the light bulp come on ;) Thanks.

>>This is the first question I have, does that mean studentType is the base class or persoType is the base class?
personType is the base class.

>>cout << studentList[count].getFirstName
getFirstName is a function, so you need parentheses just like calling any other function cout << studentList[count].getFirstName() Same with getLastName -- use parentheses as above.

Thanks for the help.

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.