// Fig 3.1 from D & D // Scott Emrich // This is a basic C++ program introducing classes #include using std::cout; // introduce the namespace for cout and endl using std::endl; // definition of our class called GradeBook: // NOTE: All words are capitalized as per D & D (also called "camelcase") class GradeBook { public: // simple function that displays a message to the user // NOTE: by D & D convention, first char of function lower, others uppercase void displayMessage() { cout << "Welcome to the grade book!" << endl; } }; // NOTE: class ended with a ";" // our main program that is executed int main () { // NOTE: We must create an object before we can call the class functions GradeBook myGradeBook; // create a GradeBook object myGradeBook.displayMessage(); // call this object's function return (0); // yay! it worked! (we think....) } // end of main function