I would like to compile the implementation of a related class to only generate an object code of it. This is the class implementation:
#include <iostream>
#include "gradebook.h"
using namespace std;
GradeBook::GradeBook(string name_course_param)
{
setCourseName(name_course_param);
}
void GradeBook::setCourseName(string name_course_param)
{
courseName = name_course_param;
}
string GradeBook::getCourseName()
{
return courseName;
}
void GradeBook::displayMessage()
{
cout << "Welcome to the grade book for\n" << getCourseName()
<< "!" << endl;
}
I know I need the interface, as you can already see I'm already using the header file gradebook.h
.
What I need to know is how to generate the object code of this class, GradeBook
, to make it available for user use of it through gradebook.h
. How to do this through g ++?