From the course: Learning C++

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Solution: Create some classes

Solution: Create some classes - C++ Tutorial

From the course: Learning C++

Solution: Create some classes

(upbeat music) - [Instructor] Here's my solution. The records.CPP file starts by including the .H file. This is important because that file contains the function prototypes, and next, notice that the constructors are simply assigning the arguments to the member variables. You can see the constructor for the student class in line three and the constructor for the course class in line 14. And the getter functions are even simpler. They just return the member variable they're supposed to return. They are all one-liners. Here you can see the constructor and getter functions for the grade class. Now let's look at the test code in codedemo.cpp. Starting at line nine, I'm creating one object for each class. We have student number one named Hilda Jones. We have course number seven named physics 101 with four credits, and we have a grade, which is for student number one, Hilda, at course number seven, physics, and she got…

Contents