Revise the program in Listing 4-4 so that it tests first the link-based implementationand then the array-based implementation. Ensure that the program does not have amemory leak.

What will be an ideal response?


```
int main()
{
BagInterface* bagPtr = new LinkedBag();
std::cout << "Testing the Link-Based Bag:" < std::cout << "The initial bag is empty." < bagTester(bagPtr);
delete bagPtr;
std::cout < bagPtr = new ArrayBag();
std::cout << "Testing the Array-Based Bag:" < std::cout << "The initial bag is empty." < bagTester(bagPtr);
delete bagPtr;
bagPtr = nullptr;
std::cout << "All done!" << std::endl;
return 0;
} // end main

```

Computer Science & Information Technology

You might also like to view...

Which of the following network types is a segment of the internal network that requires a high degree of protection?

A) Enclave network B) Trusted network C) DMZ D) Guest network

Computer Science & Information Technology

Information gathering that occurs during assessment is also known as information ____.

A. reconnaissance B. structuring C. identification D. building

Computer Science & Information Technology

What command can be used to repair a dual boot system?

A. bootsect B. bootrec C. bcdedit D. bootrep

Computer Science & Information Technology

Item E in the accompanying illustration shows the _______________ associated with the current location.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology