I am trying to call a function inside a class, when I try I get the error "no operator << matches these operands" right before instructor.displayMessage(). Also, am I calling instructor.displayMessage() correctly? I am new to c++
#include <iostream>
#include "GradeBook.h"
using namespace std;
int main()
{
GradeBook gradeBook1("CS101 Introduction to C++ Programming");
GradeBook gradeBook2("CS102 Data Structures in C++");
GradeBook instructor("");
instructor.setInstructorName();
cout << "gradeBook1 created for course: \n" << gradeBook1.getCourseName() << instructor.displayMessage()
<< "\ngradeBook2 created for course: \n" << gradeBook2.getCourseName()
<< endl;
cout << "\nPress any key to exit" << endl;
getchar();
}
Header:
#include <string>
using namespace std;
class GradeBook{
public:
GradeBook(string);
void setCourseName(string);
string getCourseName();
void displayMessage();
void setInstructorName();
string getInstructorName();
private:
string courseName;
string instructorName;
};
I didnt include the functions because I dont think they are part of the problem.