Question: 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::Bags()

show how its done please. here is the code.

template

Bags::Bags()

{

count = 0;

for (int i = 0; i

{

bgs[i] = bag;

bag[0] = 1;

count++;

}

}

template

Bags::~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 bag

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!