Section 12.1 Reading Courses: Extending the Grade class
To make things more concrete, we want to modify our grade-processing program. We will now want to generate a report that lists all the courses, along with their grades. For now it will be producing output similar to its input in a way, but internally we will develop this idea of a "Course". So our
GradeReader
class will be reading whole Course
s, whatever those are, rather than Grade
s. And we want to build on the functionality provided by Grade
, thus extending its behavior.One important thing to keep in mind is that we would like to accomplish our goal without messing with the
Grade
class itself. It’s doing its job just fine as it is, what we need is a new kind of class of objects, the Course
class, and a Course
object somehow is related to something with a Grade
. We will consider two ways to do this here, and we will then give names to these processes and say a lot more about them.