Use the following code segment for your answers to two questions below: (C++) co
ID: 3645340 • Letter: U
Question
Use the following code segment for your answers to two questions below: (C++)const int SIZE = 5;
template< class T >
class Mystery
{ public:
private:
T *what;
};
int main( )
{ int grades[ ] = { 100, 90, 87, 89, 60}; // LINE 1
Mystery object( grades); // LINE 2
cout << object << endl; // LINE 3
}
Questions:
1. The code on LINE 2 in the main() is supposed to copy all array elements of grades to the *what that is used as an array.
What is missing in the class Mystery? Come up with the implementation inside the class.
Explanation / Answer
const int SIZE = 5; template class Mystery { public: private: grades *what; }; int main( ) { int grades[ ] = { 100, 90, 87, 89, 60}; // LINE 1 Mystery object( grades); // LINE 2 coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.