Category : aggregation

Why this code doesn’t execute anything after the function course.addStudent() executed in the main? I think the problem in the this line studentsEnrolled[counter] = Student; But I can’t figure out why it’s worng! #include <iostream> #include "string.h" using namespace std; class FCIIdentity { private: string id; string fciMail; public: FCIIdentity(string d, string fcm) { id ..

Read more

when i was working on a task of creating 3 classes; student, course, ID. I made a 2d allocated instance inside "course" class called enrolledStudent the type is Student. Then i allocated it in my constructor to have dimensions of(numberOfenrolledStudents,1). When i tried to access the a member of an element of this array enrolledStudent[1][1].getName(); ..

Read more

I have a base class Vehicle, a child class Scooter and a class which holds an aggregation relation to Vehicle, called Management. This is the code of management.h: class Scooter; class Management { public: .. //(some methods use the Scooter type) private: .. }; This is an example of a method in management.cpp: bool Management::compare_scooter(std::shared_ptr<Scooter> ..

Read more