Howdy. I have been pondering how I would go about taking, in this case, the name of a subject (for a GPA tracking program), and pass it through to an overloaded constructor. I figured pointers were the solution, but nonetheless I kept getting "int to char" errors and the like. Here is a stubbed out version of what I've attempted so far:
Course(int pname, float credits, unsigned short sem, unsigned short per);
unsigned short Semesters;
unsigned short Period;
Course::Course(int pname, float credits, unsigned short sem, unsigned short per)
courseName = * pname; // so this should give the string,
// and courseName is a string
// identical to the local string
// in int main(). Where have I
// fouled things up?
creditsAtt = credits;
Semesters = sem;
Period = per;
float credits = 0;
unsigned short sem = 0;
unsigned short per = 0;
// ( I deleted a lot of explanation, irrelevant stuff here )
Course * All = new Course;
Course * pCourse;
int * pname = 0; // OK, setting a pointer for each string
for(short p = 0; p < 9; p++)
cout << "\nPlease enter the name of period number " << p << ", 10 characters max please:\t";
pname = &name; // OK. So this sets the pointer to name's
// address, right?
// ( deleted more irrelevant stuff, questions for info )
pCourse = new Course(pname, credits, sem, per); // OK, so
// this should set name's address at pname into the parameter?
All[p] = * pCourse;
delete pname; // do I have to do this in this case?
delete  All;
END OF CODE
Hey, thanks a billion. Just wondered if anyone could give this a quick scan and detect my obvious error. :-P