Lab 8


~/2020_S19/wk8/
Files

wget http://www.cs.csubak.edu/~derrick/cs2020/examples/lab8/Box.h
wget http://www.cs.csubak.edu/~derrick/cs2020/examples/lab8/Box.cpp
wget http://www.cs.csubak.edu/~derrick/cs2020/examples/lab8/BoxInterface.h
wget http://www.cs.csubak.edu/~derrick/cs2020/examples/lab8/Toy.h
wget http://www.cs.csubak.edu/~derrick/cs2020/examples/lab8/Toy.cpp
wget http://www.cs.csubak.edu/~derrick/cs2020/examples/lab8/ToyBox.h
wget http://www.cs.csubak.edu/~derrick/cs2020/examples/lab8/ToyBox.cpp
wget http://www.cs.csubak.edu/~derrick/cs2020/examples/lab8/main.cpp

The purpose of this lab is to practice declaring and defining a class template copy constructor and overloaded assignment operator. In this lab, we will use the Box class discussed in class and add the prototypes for the Box copy constructor and the Box overloaded assignment operator. In addition, we will practice the benefits of abstraction, inheritance, and class templates that will allow the Box and ToyBox class to accept our own Abstract Data Type Toy.


For this lab you will use the following files here and build from them. Within the Box header file and Box implementation file, you will add the prototype and definition for the copy constructor and the overloaded assignment operator.

For OOP semantic purposes, the ToyBox class is a derived class of Box<ItemType>. The interface for this class is a default constructor that will invoke the Box default constructor and a constructor that accepts an ItemType that will invoke the Box(const ItemType) constructor - passing the passed parameter. You will use the given ToyBox.h as a reference to write the definitions for these constructors within the ToyBox.cpp implementation file. These definitions will be defined as empty definitions.

Given to you is a complete simple implementation for the Toy class. Your task is to write the header file for Toy, such that it will include a preprocessor directive: #ifndef TOY_H #define TOY_H. In addition you will use the given implementation file to correspondingly create the class definition with public member variable char toyname[MAX], and public constructors, destructor, and public member function and operator prototypes. Be sure to include the implementation file for Toy.cpp before you close the preprocessor #endif.

Files to edit: Box.h, Box.cpp, ToyBox.cpp, Toy.h

==================================
Testing Template Object
box1: 123
box2: 123

==================================
Testing Template Object Pointer
iBox1: 321
iBox2: 321
iBox3: 321

==================================
Testing Derived Template Object With ADT 'Toy'
Enter Toy Name: Stuffed Animal
userToyBox: Toy Name => Stuffed Animal
toybox: Toy Name => Hot Wheels
copy: Toy Name => Hot Wheels
copy2: Toy Name => Hot Wheels

==================================
Testing Base Template Object Pointer With ADT 'Toy'
tBox: Toy Name => Hot Wheels


Show me your completed code in class or have ALL the files within your depository directory. ~/2020_S19/wk8/