Ok im creating a program to make a database of people associated with a university, these people are called universitypeople, i have another file universitydatabase which stores all these people and will edit their information... well im having these errors when i type make... the errors could be class based or pointer based im not sure, but ill include a handful of the files im using for this thread... any help or suggestions would be appreciated
g++ -c universitydatabase.cpp
universitydatabase.cpp: In member function `void UNIVERSITYDATABASE::addNewPerson(UNIVERSITYPERSON*)':
universitydatabase.cpp:18: error: request for member `fullname' in `newMember->node::person', which is of non-class type `UNIVERSITYPERSON*'
universitydatabase.cpp:19: error: request for member `fullname' in `newPerson', which is of non-class type `UNIVERSITYPERSON*'
universitydatabase.cpp:20: error: cannot convert `UNIVERSITYPERSON*' to `node*' in assignment
universitydatabase.cpp:24: error: request for member `fullname' in `newMember->node::person', which is of non-class type `UNIVERSITYPERSON*'
universitydatabase.cpp:25: error: request for member `fullname' in `newPerson', which is of non-class type `UNIVERSITYPERSON*'
universitydatabase.cpp:27: error: cannot convert `UNIVERSITYPERSON*' to `node*' in assignment
make: *** [universitydatabase.o] Error 1
//universitydatabase.h
#ifndef UNIVERSITYDATABASE_H
#define UNIVERSITYDATABASE_H
#include "universityperson.h"
typedef struct node {
UNIVERSITYPERSON *person;
struct node *next;
};
class UNIVERSITYDATABASE {
struct node *database;
public:
UNIVERSITYDATABASE() { database = NULL; }
void addNewPerson( UNIVERSITYPERSON *newPerson );
node *getDatabase();
};
#endif
//universitydatabase.cpp
#include "universitydatabase.h"
void UNIVERSITYDATABASE::addNewPerson( UNIVERSITYPERSON *newPerson ){
node *newMember, *temp, *temp2;
if( database == NULL ){
database->person = newPerson;
database->next = NULL;
}
else{
newMember = database;
if( strcmp( toupper( atoi( newMember->person.fullname ) ), //error points here (tried atoi but didnt change error)
toupper( newPerson.fullname ) ) = 1 ){ //error points here
temp = newMember->person;
newMember->person = newPerson;
newMember->next = temp;
}
if( strcmp( toupper( newMember->person.fullname), //error points here
toupper( newPerson.fullname ) ) = -1 ){ //error points here
temp = newMember->next;
newMember->next = newPerson;
}
temp = new node;
temp->person = newPerson;
temp->next = NULL;
newMember->next = temp;
}
}
node* UNIVERSITYDATABASE::getDatabase(){
return database;
}
// universityperson.h
#ifndef UNIVERSITYPERSON_H
#define UNIVERSITYPERSON_H
#include "lib.h"
class UNIVERSITYPERSON{
string fullname, id;
bool employee, student, alumnus, position;
public:
UNIVERSITYPERSON(){
fullname = "No Name";
id = "00000000";
employee = 0;
student = 0;
alumnus = 0;
position = 0;
cout << toString();
};
string getFullName();
string getID();
string getPosition();
string toString();
~UNIVERSITYPERSON(){
cout << "Universityperson destructor: University Person is " << toString();
};
};
#endif
//universityperson.cpp
#include "universityperson.h"
string UNIVERSITYPERSON::getFullName(){
return fullname;
}
string UNIVERSITYPERSON::getID(){
return id;
}
string UNIVERSITYPERSON::getPosition(){
if( !position )
return( " " );
if( employee )
return( "Employee" );
if( student )
return( "Student" );
if( alumnus )
return( "Alumnus" );
}
string UNIVERSITYPERSON::toString(){
return( fullname + ", " + id + ", " + getPosition() + "\n" );
}
any other files you want i can put on here but im fairly positive the error is on these files