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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!