Need help with linked list
How can I access the private data members of the other class. There are two classes - a recordClass and databaseClass
// recordClass declaration
recordClass {
public:
// set and get functions
private:
string studentName;
double Grade;
.....
}
=================================
// databaseClass declaration
struct listNode{
recordClass item;
listNode* next;
}
databaseClass {
public:
// constructor and destructor
// insert and delete functions
void insert(string, double....);
private:
int size;
listNode* head;
}
=============================================
// insert function
void databaseClass::insert(string name, double gpa...)
{
listNode* cur = head;
listNode* prev = NULL;
recordClass temp;
// QUESTION: how can I put the gpa into temp so that I can
// compare it with whatever is in the list. I am trying to insert
// a record in the sorted list.
recordClass temp = gpa.getGpr();
while (cur ! = NULL && cur->item.getGpr() < temp) {
prev = cur;
cur = cur->next;
}
HELP PLEASE!!!!!!!!!