Answered step by step
Verified Expert Solution
Link Copied!

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] =

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

1. Identify outcomes (e.g., quality, accidents).

Answered: 1 week ago