I'm going bonkers and I can't figure out what the heck I'm doing wrong. :\
I have to modify a program from the text book so that it's output looks something like this:
Instructor name: John Doe
New instructor name: Professor Xavier
Welcome to the grade book for Intro to C++ programming!
I can get it to run, except when I try to create an object in the main function.
Code:
//function main
#include <iostream>
#include <string>
using namespace std;
#include "GradeBook.h"
int main()
{
GradeBook myGradeBook;
cout << "running..." << endl;
system("pause");
return 0;
}
Code:
// gradebook.cpp
#include <iostream>
using namespace std;
#include "GradeBook.h"
GradeBook::GradeBook( string name, string iname )
{
setCourseName( name );
setInstructor( iname );
}
void GradeBook::setCourseName( string name )
{
courseName = name;
}
string GradeBook::getCourseName()
{
return courseName;
}
void GradeBook::setInstructor( string iname )
{
instructorName = iname;
}
string GradeBook::getInstructor()
{
return instructorName;
}
Code:
// gradebook.h
#include <string>
using namespace std;
class GradeBook
{
public:
GradeBook( string, string );
void setCourseName( string );
string getCourseName();
void setInstructor( string );
string getInstructor();
void displayMessage();
private:
string courseName;
string instructorName;
};
The assignment is in Deitel's C How to Program 5th Edition, Chapter 19. Review question 19.11
DevC++ is giving me "no matching function for call to `GradeBook::GradeBook()' " on line 13 on main.cpp. I'm not understanding or even seeing that error.
Thanks for any help.
**
EDIT: Proof I've been starring at this too long...I was missing parenthesis, but I'll probably need help anyway. o_o **