Question: Given the following template class. Please code the add function and full function. (11 points) #ifndef BAG_H_ #define BAG_H_ #include #define SIZE 20 using namespace
Given the following template class. Please code the add function and full function. (11 points) #ifndef BAG_H_ #define BAG_H_ #include #define SIZE 20 using namespace std; template class bag { public: bag(); //constructor bool add( T item); //add an item into bag bool remove( ) ; //remove an item from bag bool empty( ); //check if the bag is empty bool full( ); //check if the bag is full int size( ); //return size of bag int clear( ); //clear the bag private: T arr[SIZE]; //storing items int counter; //counting how many items in the bag }; #endif
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
