Answered step by step
Verified Expert Solution
Question
1 Approved Answer
show how its done please. here is the code. template Bags ::Bags() { count = 0; for (int i = 0; i { bgs[i] =
show how its done please. here is the code.
template
Bags
{
count = 0;
for (int i = 0; i
{
bgs[i] = bag;
bag[0] = 1;
count++;
}
}
template
Bags
{
for (int i = 0; i
{
bgs[i] = NULL;
}
count = 0;
}
and bag.h
#include
#include "bag.h"
template
class Bags: private Bag
{
public:
// constructor
Bags();
// destructor
~Bags();
private:
T bgs[10];
int count;
T bag;
};
#include "bags.cpp"
Sometimes one bag just isn't enough. Let's create a Bags class that allocates ten bags for the user via the array bgs. You are to complete the private member data in bags.h and write the default constructor and destructor in bags.cpp. The constructor should add the item 1 to each bagStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started