The problem that I have is that in CourseSchedule.cpp's function "void AddCourse (Course)" I am not able to find any way to copy the passed "Course a"'s "Date startDate" into "courses[numCourses].startDate"
What does member wise assignment mean? Do I need to make "CourseSchedule" class a child class for "Course"? I think I could add public set functions to "Date" and "Time" and make it work, but I do not think my professor wants me to do that.
The instructions were to:
"Create a function named AddCourse that takes a Course as an argument and adds this course to the ClassSchedule array. You do NOT need to allocate any new memory since we allocated a max size for our ClassSchedule array. As long as you didn’t make any of the Course member variables const you should be able to use memberwise assignment to add the course to the proper element of the array (numCourses is the current element) – you should add one to numCourses when you add a new Course to the ClassSchedule."
Here are the source files. I am extremely extremely sorry for not being able to shorten this for you just to address the problem at hand, I simply do not have the time as I am running low on laptop battery. Any help towards how to solve this without adding public set functions would be greatly appreciated!
Main.cpp:
#include <iostream> #include "Time.h" #include "Date.h" #include "Course.h" - Pastebin.com
Time.cpp:
#include <iostream> #include <iomanip> using namespace std; #include "Time. - Pastebin.com
Time.h:
//Time Class Definition with const member functions #ifndef TIME_H #define TIM - Pastebin.com
Date.cpp:
#include <iostream> using namespace std; #include "Date.h" ostream& opera - Pastebin.com
Date.h:
#ifndef DATE_H #define DATE_H class Date { friend ostream& operator<<( - Pastebin.com
Course.cpp:
#include <iostream> using namespace std; #include "Course.h" ostream& ope - Pastebin.com
Course.h:
#ifndef COURSE_H #define COURSE_H #include "Date.h" #include "Time.h" cl - Pastebin.com
CourseSchedule.cpp:
#include "CourseSchedule.h" ostream& operator<< (ostream &output, const Cours - Pastebin.com
CourseSchedule.h:
#ifndef COURSESCHEDULE_H #define COURSESCHEDULE_H #include <iostream> using - Pastebin.com