I got a task where I must write the header file to the main.cpp (see below). I have found out that I must create classes and somehow make them remember other class-objects to get the output screen that is given, as well. However, I can't figure out how to achieve it... I have begun writing the code, below it is visible, as well.
Inbox for consumer Blaise:
sports for blaise
cultural news for blaise
Cultural news for consumer Blaise:
cultural news for blaise
Sports news for consumer Blaise:
sports for blaise
Inbox for consumer Dirk:
sports for dirk
cultural news for dirk
Cultural news for consumer Dirk:
cultural news for dirk
Sports news for consumer Dirk:
sports for dirk
If you make some changes along the following lines and write some code for adding to the <vector> lists, then write the publishNews() function, you'll be well on your way to doing your homework.
Inbox for consumer Blaise:
Cultural news for consumer Blaise:
Sports news for consumer Blaise:
Inbox for consumer Dirk:
Cultural news for consumer Dirk:
Sports news for consumer Dirk:
Program ended with exit code: 0
The problem is that I can't change the main.cpp, I can only work in solution.hpp ^^' But yeah, my idea is to somehow make difference between SportsNews and CulturalNews class (like deciding the object uses which class) and then publish it to the right vector, so it'd make printing it out easier
Well main L17-18 don't make sense. news1 is set to the address of nn1 and is then immediately set to the address of nn3 ??? Which do you want?
IMO giving an output and main() and asked to design and code the classes is not a good way. You either get the class design and the output and code the classes and main() or you get the program description and design your own classes, main etc.
These three functions all print a header and a list of News from a source.
The printInbox() prints all News.
The printCultural() prints only the CulturalNews.
The printSports() prints only the SportsNews.
I bet that the class has discussed dynamic_cast ...
... and yes, class hierarchy is peculiar implementation for a table that has two columns: newstext and news category. Wait till you get a news that is about both culture and sports ...
Inbox for consumer Blaise:
sports for blaise
cultural news for blaise
Cultural news for consumer Blaise:
cultural news for blaise
Sports news for consumer Blaise:
sports for blaise
Inbox for consumer Dirk:
sports for dirk
cultural news for dirk
Cultural news for consumer Dirk:
cultural news for dirk
Sports news for consumer Dirk:
sports for dirk
The really hard part in this is that the shown output has an empty line both before and after everything, but otherwise only a single empty line per function.