Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Say you have implementations of all the classes in the following UML class diagram ( Figure 2 ) : umm 1 Write down the C

Say you have implementations of all the classes in the following UML class diagram(Figure 2):
umm
1 Write down the C++ code you would add to each class definition to define a toString() member function for these classes. Note: Don't write implementations for these functions, just give the function headers that need to be added to the class definitions. (3)
2 Write an implementation of toString() for the Stock class (to be placed in stock.cpp). It should return all the information about a Stock instance, including labels for each data member. The function must use partial overriding. (4)
3 Say you have the implementation of the AssetList class, as depicted in the following UML diagram(Figure 3) :
UML
Write code for a function called outputAll() to output the information of all the assets in an AssetList instance to the console (i.e. to the standard output device). You can assume that a QTextStream called cout has been declared as a global variable. Note that the function should not be a member function of the AssetList class. It should be a stand-alone function that takes an AssetList as parameter. (4)
4 Explain the difference between polymorphism and polymorphic assignment, and state where they are applied in your answer to Question 3.(5)
5 Explain why it is acceptable to make the AssetList parameter of the outputAll() function a value parameter instead of a const-reference parameter or passing it by pointer.(4)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

2 What can organisations do to improve employee utilisation?

Answered: 1 week ago

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago