And the program knows that you’re talking about the courseName variable. How is this possible since they are two different variables
One was copied into the other, by virtue of passing it to a function.
This is how functions work. Consult the first couple of chapters of your C++ book for more info.
How does it tie in with the gradebook function class?
It doesn’t, at all. You simply passed a function argument.
solved C++ Classes/Confusion