Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Questions about the PlainBox , ToyBox and MagicBox . x and MagicBox are given below: class PlainBox { private: // Data field ItemType item; public:

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Questions about the PlainBox , ToyBox and MagicBox . x and MagicBox are given below: class PlainBox \{ private: // Data field ItemType item; public: // Default constructor PlainBox(); // Parameterized constructor PlainBox(const ItemType\& theltem); //Mutator method that can change the value of the data field // Mutator method that can change the value of the data field void setItem(const ItemType\& theltem); //Accessor method to get the value of the data field ItemType getitem() const; \}; // end PlainBox enum Color \{BLACK, RED, BLUE, GREEN, YELLOW, WHITE\}; template class ToyBox : public PlainBox \{ private: Color boxColor; public: ToyBox(); ToyBox(const Color\& theColor); ToyBox(const ItemType\& theltem, const Color\& theColor); void setColorlconst Color\& theColor). ToyBox(const ItemType\& theltem, const Color\& theColor); void setColor(const Color\& theColor); Color getColor() const; I these member functions are inherited from the hase class void setitem(const ItemType\& theltem); ItemType getitem() const; / \}; // end ToyBox template class MagicBox : public PlainBox \{ private: bool firstltemStored; public: MagicBox(); MagicBox(const ItemType\& theltem); bool firstltemStored; public: MagicBox(); MagicBox(const ItemType\& theltem); void setitem(const ItemType\& theltem); end MagicBox uestion 3 (5 points) Which of the following implementations is correct for the constructor in ToyBox? a) template ToyBox::ToyBox(const ItemType\& theltem, const Color\& theColor) \{ PlainBox> (); PlainBox>: :setItem(theltem); boxColor = theColor; \}// end constructor \} // end constructor b) template> ToyBox>:: ToyBox(const ItemType\& theltem, const Color\& theColor) \{ boxColor = the Color \} // c) None of these answers d) template> ToyBox::ToyBox(const ItemType\& theltem, const Color\& theColor) \{ item = theltem; boxColor = theColor; \} // end constructor

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions