This code is from the book. I just want to ask why do we have to add the
myGradeBook.getCourseName() in the main function. The program will work without it. It says in the comments that it displays the initial value of courseName. Can someone explain it to me in more detail?? Thank you
Line 38 is simply showing you that courseName is empty.
i.e. courseName is a string and string's default constructor was called when myGradeBook was instantiated which initialized courseName to an empty string.